Object that stores java properties file format data
package | Default |
---|
__construct(array $data = null)
array
A 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 |
|
---|
string
The key we are looking for
mixed
The value that is associated to the provided key
getAt(integer $index): mixed
Throws |
|
---|
integer
The position we are looking for
mixed
The value that is located at the specified position
getKeys(): array
array
List of strings containing all the HashMapObject sorted keys.
getValues(): array
array
List of elements containing all the HashMapObject sorted values
isEqualTo(mixed $properties,boolean $strictOrder = false): boolean
mixed
java properties value to compare (a string or a JavaPropertiesObject instance)
boolean
If set to true, both properties elements must have the same keys with the same order. Otherwise differences in key sorting will be accepted
boolean
true if both java properties data is exactly the same, false if not
isJavaProperties(mixed $value): boolean
mixed
A value to check (a string or a JavaPropertiesObject instance)
boolean
true if the given value contains valid Java Properties data, false otherwise
isKey(mixed $key): boolean
mixed
A value to find on the currently stored keys.
boolean
True if the provided value is a valid HashMap key, false in any other case
length(): integer
integer
The number of items inside the collection
pop(): mixed
Throws |
|
---|
mixed
The value on the last element of the list
remove(string $key): mixed
Throws |
|
---|
string
The key for the key/value pair we want to delete
mixed
The value from the key/value pair that's been deleted.
rename(string $key,string $newKey): boolean
Throws |
|
---|
string
The name we want to change
string
The new name that will replace the previous one
boolean
True if rename was successful
reverse(): void
set(string $key,mixed $value): mixed
If the key already exists, value will be replaced.
Throws |
|
---|
string
A string that labels the provided value
mixed
A value to be stored with the provided key
mixed
The value after being stored to the collection
shift(): mixed
Throws |
|
---|
mixed
The value on the first element of the list
sortByKey(string $method = self::SORT_METHOD_STRING,string $order = self::SORT_ORDER_ASCENDING): boolean
Throws |
|
---|
string
Defines sort mode: HashMapObject::SORT_STRING or HashMapObject::SORT_NUMERIC
string
Defines the order for the sorted elements: self::SORT_ORDER_ASCENDING (default) or self::SORT_ORDER_DESCENDING
boolean
True if sort was successful false on failure
swap(string $key1,string $key2): boolean
Throws |
|
---|
string
The first key to exchange
string
The second key to exchange
boolean
True 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.
string
A valid Java .properties string ready to be stored on a .properties file
SORT_METHOD_STRING
SORT_METHOD_NUMERIC
SORT_ORDER_ASCENDING
SORT_ORDER_DESCENDING