new DoubleKeyMap()
Crates and empty DoubleKeyMap
Method Summary
- exist
- Checks if there is a value in the first map at the specified key.
- existReverse
- Checks if there is a value in the second map at the specified key.
- forEach
- Executes a given callback passing each element of the first map as the only call parameter.
- forEachReverse
- Executes a given callback passing each element of the second map as the only call parameter.
- get
- Gets an element from the first map using the given key.
- getReverse
- Gets an element from the second map using the given key.
- remove
- Uses the given key to remove an element from the first map and the related element in the second map.
- removeReverse
- Uses the given key to remove an element from the second map and the related element in the first map.
- set
- Inserts new values in the maps.
Method Detail
-
exist(a) → {Boolean}
-
Checks if there is a value in the first map at the specified key.
Parameters:
Name Type Description a
Object the key to be used to get the element from the first map. Returns:
true if the element exists, false otherwise.- Type
- Boolean
-
existReverse(b) → {Boolean}
-
Checks if there is a value in the second map at the specified key.
Parameters:
Name Type Description b
Object the key to be used to get the element from the second map. Returns:
true if the element exists, false otherwise.- Type
- Boolean
-
forEach(callback)
-
Executes a given callback passing each element of the first map as the only call parameter.
Callbacks are executed synchronously before the method returns: calling #set, {@link #remove} or #removeReverse during callback execution may result in a wrong iteration.Parameters:
Name Type Description callback
function The callback to be called. -
forEachReverse(callback)
-
Executes a given callback passing each element of the second map as the only call parameter.
Callbacks are executed synchronously before the method returns: calling #set, {@link #remove} or #removeReverse during callback execution may result in a wrong iteration.Parameters:
Name Type Description callback
function The callback to be called. -
get(a) → {Object}
-
Gets an element from the first map using the given key.
Parameters:
Name Type Description a
Object the key to be used to get the element from the first map. Returns:
the found value if any or an undefined value- Type
- Object
-
getReverse(b) → {Object}
-
Gets an element from the second map using the given key.
Parameters:
Name Type Description b
Object the key to be used to get the element from the second map. Returns:
the found value if any or an undefined value- Type
- Object
-
remove(a)
-
Uses the given key to remove an element from the first map and the related element in the second map.
Parameters:
Name Type Description a
Object the key to be used to remove the element from the first map. -
removeReverse(b)
-
Uses the given key to remove an element from the second map and the related element in the first map.
Parameters:
Name Type Description b
Object the key to be used to remove the element from the second map. -
set(a, b)
-
Inserts new values in the maps. If one of the keys is already present in the respective map, its value is overwritten and the related entry on the other map is deleted. If both the keys are already present in their respective map a swapping to maintain uniqueness in both maps is performed.
Parameters:
Name Type Description a
Object the key to be used to insert the other value in the first map. It can't be null nor missing. b
Object the key to be used to insert the other value in the second map. It can't be null nor missing. Throws:
-
if one (or both) of the specified values is null or missing.
-