K - key typeV - value typepublic class AutoIndex<K,V> extends java.lang.Object implements Index<K,V>
| Constructor and Description |
|---|
AutoIndex(Function<V,K> indexer)
Constructs an index using the given indexer.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(V value)
Adds the given value to the index.
|
java.util.Set<V> |
find(K key)
Finds all values indexed by the given key.
|
void |
forEachValue(Consumer<V> consumer)
Iterates over each value indexed by this index.
|
K |
getKey(V value)
Calculates the key for the given value.
|
java.util.Set<K> |
getKeys()
Retrieves the set of all keys.
|
boolean |
remove(V value)
Removes the given value from the index.
|
public K getKey(V value)
value - value to calculate the key forpublic boolean add(V value)
value - value to be addedpublic boolean remove(V value)
value - value to removepublic java.util.Set<V> find(K key)
Indexpublic java.util.Set<K> getKeys()
Index