Object that stores java properties file format data
| package | Default |
|---|
__construct(array $data = null)
arrayA value that will be used to initialize the HashMapObject. It can be an associative array (where each key/value will be directly assigned to the HashMap), or a plain array in which case the keys will be copied from each element numeric index
get(string $key): mixed
| Throws |
|
|---|
stringThe key we are looking for
mixedThe value that is associated to the provided key
getAt(integer $index): mixed
| Throws |
|
|---|
integerThe position we are looking for
mixedThe value that is located at the specified position
getKeys(): array
arrayList of strings containing all the HashMapObject sorted keys.
getValues(): array
arrayList of elements containing all the HashMapObject sorted values
isEqualTo(mixed $properties,boolean $strictOrder = false): boolean
mixedjava properties value to compare (a string or a JavaPropertiesObject instance)
booleanIf set to true, both properties elements must have the same keys with the same order. Otherwise differences in key sorting will be accepted
booleantrue if both java properties data is exactly the same, false if not
isJavaProperties(mixed $value): boolean
mixedA value to check (a string or a JavaPropertiesObject instance)
booleantrue if the given value contains valid Java Properties data, false otherwise
isKey(mixed $key): boolean
mixedA value to find on the currently stored keys.
booleanTrue if the provided value is a valid HashMap key, false in any other case
length(): integer
integerThe number of items inside the collection
pop(): mixed
| Throws |
|
|---|
mixedThe value on the last element of the list
remove(string $key): mixed
| Throws |
|
|---|
stringThe key for the key/value pair we want to delete
mixedThe value from the key/value pair that's been deleted.
rename(string $key,string $newKey): boolean
| Throws |
|
|---|
stringThe name we want to change
stringThe new name that will replace the previous one
booleanTrue if rename was successful
reverse(): void
set(string $key,mixed $value): mixed
If the key already exists, value will be replaced.
| Throws |
|
|---|
stringA string that labels the provided value
mixedA value to be stored with the provided key
mixedThe value after being stored to the collection
shift(): mixed
| Throws |
|
|---|
mixedThe value on the first element of the list
sortByKey(string $method = self::SORT_METHOD_STRING,string $order = self::SORT_ORDER_ASCENDING): boolean
| Throws |
|
|---|
stringDefines sort mode: HashMapObject::SORT_STRING or HashMapObject::SORT_NUMERIC
stringDefines the order for the sorted elements: self::SORT_ORDER_ASCENDING (default) or self::SORT_ORDER_DESCENDING
booleanTrue if sort was successful false on failure
swap(string $key1,string $key2): boolean
| Throws |
|
|---|
stringThe first key to exchange
stringThe second key to exchange
booleanTrue if the two key/value pairs positions were correctly exchanged
toString(): string
The output of this method is ready to be stored on a physical .properties file.
stringA valid Java .properties string ready to be stored on a .properties file
SORT_METHOD_STRING
SORT_METHOD_NUMERIC
SORT_ORDER_ASCENDING
SORT_ORDER_DESCENDING