public interface IMultiLookup<Key,Value>
Implementors must provide semantic (not identity-based) hashCode() and equals() using the static helpers hashCode(IMultiLookup)
and equals(IMultiLookup, Object)
here.
Modifier and Type | Interface and Description |
---|---|
static class |
IMultiLookup.ChangeGranularity
How significant was the change? *
|
Modifier and Type | Method and Description |
---|---|
IMultiLookup.ChangeGranularity |
addPair(Key key,
Value value)
Adds key-value pair to the lookup structure.
|
IMultiLookup.ChangeGranularity |
addPairPositiveMultiplicity(Key key,
Value value,
int count)
Updates multiplicity of key-value pair by a positive amount.
|
void |
clear()
Empties out the lookup structure.
|
int |
countKeys() |
java.lang.Iterable<Key> |
distinctKeys() |
java.lang.Iterable<Value> |
distinctValues()
Iterates once over each distinct value.
|
static <Key,Value> |
equals(IMultiLookup<Key,Value> self,
java.lang.Object obj)
Provides semantic equality comparison.
|
static <Key,Value> |
hashCode(IMultiLookup<Key,Value> memory)
Provides semantic hashCode() comparison.
|
IMemoryView<Value> |
lookup(Key key)
Returns a (read-only) bucket of values associated with the given key.
|
default IMemoryView<Value> |
lookupOrEmpty(Key key)
Returns a (read-only) bucket of values associated with the given key.
|
IMemoryView<Value> |
lookupUnsafe(java.lang.Object key)
Returns a (read-only) bucket of values associated with the given key, which can be of any type.
|
default IMemoryView<Value> |
lookupUnsafeOrEmpty(java.lang.Object key)
Returns a (read-only) bucket of values associated with the given key.
|
IMultiLookup.ChangeGranularity |
removePair(Key key,
Value value)
Removes key-value pair from the lookup structure.
|
IMemoryView<Value> lookup(Key key)
key
- a key for which associated values are soughtdefault IMemoryView<Value> lookupOrEmpty(Key key)
key
- a key for which associated values are soughtIMemoryView<Value> lookupUnsafe(java.lang.Object key)
key
- a key for which associated values are sought (may or may not be of Key type)default IMemoryView<Value> lookupUnsafeOrEmpty(java.lang.Object key)
key
- a key for which associated values are sought (may or may not be of Key type)java.lang.Iterable<Key> distinctKeys()
int countKeys()
java.lang.Iterable<Value> distinctValues()
IMultiLookup.ChangeGranularity addPair(Key key, Value value)
java.lang.IllegalStateException
- if addition would cause duplication that is not permittedIMultiLookup.ChangeGranularity removePair(Key key, Value value)
java.lang.IllegalStateException
- if removing non-existing element that is not permittedIMultiLookup.ChangeGranularity addPairPositiveMultiplicity(Key key, Value value, int count)
PRE: count > 0
java.lang.IllegalStateException
- if addition would cause duplication that is not permittedvoid clear()
static <Key,Value> boolean equals(IMultiLookup<Key,Value> self, java.lang.Object obj)
static <Key,Value> int hashCode(IMultiLookup<Key,Value> memory)