Package org.jgrapes.core
Class Components.PoolingIndex<K,V>
java.lang.Object
org.jgrapes.core.Components.PoolingIndex<K,V>
- Type Parameters:
K- the key typeV- the value type
- Enclosing class:
Components
An index of pooled items.
Each key is associated with a set of values. Values can be added or retrieved from the set.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds the value to the pool of values associated with the key.voidclear()Remove all entries.booleancontainsKey(Object key) Checks if the key is in the index.booleanisEmpty()Checks if the index is empty.keySet()Returns all keys.intkeysSize()Returns the number of keys in the index.Retrives and removes an item from the pool associated with the key.Removes the given value from the pool associated with the given key.Removes the value from the first pool in which it is found.voidRemoves all values associated with the key.
-
Constructor Details
-
PoolingIndex
public PoolingIndex()
-
-
Method Details
-
clear
Remove all entries. -
containsKey
Checks if the key is in the index.- Parameters:
key- the key- Returns:
- true, if successful
-
isEmpty
Checks if the index is empty.- Returns:
- true, if is empty
-
keySet
Returns all keys.- Returns:
- the sets the
-
add
Adds the value to the pool of values associated with the key.- Parameters:
key- the keyvalue- the value- Returns:
- the v
-
poll
Retrives and removes an item from the pool associated with the key.- Parameters:
key- the key- Returns:
- the removed item or
nullif the pool is empty
-
removeAll
Removes all values associated with the key.- Parameters:
key- the key
-
remove
Removes the given value from the pool associated with the given key.- Parameters:
key- the keyvalue- the value- Returns:
- the v
-
remove
Removes the value from the first pool in which it is found.- Parameters:
value- the value- Returns:
- the value or
nullif the value is not found
-
keysSize
Returns the number of keys in the index.- Returns:
- the numer of keys
-