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
-
Method Summary
Modifier and TypeMethodDescriptionAdds the value to the pool of values associated with the key.void
clear()
Remove all entries.boolean
containsKey
(Object key) Checks if the key is in the index.boolean
isEmpty()
Checks if the index is empty.keySet()
Returns all keys.int
keysSize()
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.void
Removes 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
null
if 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
null
if the value is not found
-
keysSize
Returns the number of keys in the index.- Returns:
- the numer of keys
-