public interface BikeyMap<R,C,V> extends java.lang.Iterable<BikeyEntry<R,C,V>>
Modifier and Type | Method and Description |
---|---|
BikeySet<R,C> |
bikeySet()
Returns a
BikeySet view of the bikeys contained in this map. |
void |
clear()
Removes all of the mappings from this map.
|
java.util.Set<C> |
columnKeySet()
Returns a set of column keys that have one or more values in the map.
|
default V |
compute(R row,
C column,
TriFunction<? super R,? super C,? super V,? extends V> remappingFunction)
Attempts to compute a mapping for the specified bikey and its current
mapped value or
null if there is no current mapping. |
default V |
computeIfAbsent(R row,
C column,
java.util.function.BiFunction<R,C,? extends V> mappingFunction)
If the specified bikey is not already associated with a value, attempts
to compute its value using the given mapping function and enters it into
this map unless
null . |
default V |
computeIfPresent(R row,
C column,
TriFunction<? super R,? super C,? super V,? extends V> remappingFunction)
If the value for the specified bikey is present and non-null, attempts to
compute a new mapping given the bikey and its current mapped value.
|
boolean |
containsColumn(java.lang.Object column)
Returns true if the map contains a mapping with the specified
column.
|
default boolean |
containsKey(R row,
C column)
Returns true if this map contains a mapping for the specified
bikey.
|
boolean |
containsRow(java.lang.Object row)
Returns true if the map contains a mapping with the specified
row key.
|
boolean |
containsValue(java.lang.Object value)
Returns true if this map maps one or more bikeys to the
specified value.
|
java.util.Set<BikeyEntry<R,C,V>> |
entrySet()
Returns a
Set view of the mappings contained in this map. |
boolean |
equals(java.lang.Object o)
Compares the specified object with this map for equality.
|
default void |
forEach(java.util.function.BiConsumer<Bikey<R,C>,? super V> action)
Performs the given action for each entry in this map until all entries
have been processed or the action throws an exception.
|
void |
forEach(TriConsumer<? super R,? super C,? super V> action)
Performs the given action for each entry in this map until all entries
have been processed or the action throws an exception.
|
void |
forEachBikey(java.util.function.BiConsumer<? super R,? super C> action)
Performs the given action for each bikey in this map until all entries
have been processed or the action throws an exception
|
V |
get(R row,
C column)
Returns the value to which the specified bikey is mapped, or
null
if this map contains no mapping for the bikey. |
default V |
getOrDefault(R row,
C column,
V defaultValue)
Returns the value to which the specified bikey is mapped, or
defaultValue if this map contains no mapping for the bikey. |
int |
hashCode()
Returns the hash code value for this map.
|
default boolean |
isEmpty()
Returns true if this map contains no bikey-value mappings.
|
java.util.Set<Bikey<R,C>> |
keySet()
Returns a
Set view of the bikeys contained in this map. |
default V |
merge(R row,
C column,
V value,
java.util.function.BiFunction<? super V,? super V,? extends V> remappingFunction)
If the specified bikey is not already associated with a value associates
it with the given non-null value.
|
V |
put(R row,
C column,
V value)
Associates the specified value with the specified bikey in this map.
|
default void |
putAll(BikeyMap<? extends R,? extends C,? extends V> m)
Copies all of the mappings from the specified map to this map.
|
default V |
putIfAbsent(R row,
C column,
V defaultValue)
If the specified bikey is not already associated with a value associates
it with the given value and returns
null , else returns the
current value. |
V |
remove(R row,
C column)
Removes the mapping for a bikey from this map if it is present.
|
default boolean |
remove(R row,
C column,
java.lang.Object value)
Removes the entry for the specified bikey only if it is currently mapped
to the specified value.
|
default V |
replace(R row,
C column,
V value)
Replaces the entry for the specified bikey only if it is currently mapped
to some value.
|
default boolean |
replace(R row,
C column,
V oldValue,
V newValue)
Replaces the entry for the specified bikey only if currently mapped to
the specified value.
|
java.util.Set<R> |
rowKeySet()
Returns a set of row keys that have one or more values in the map.
|
int |
size()
Returns the number of bikey-value mappings in this map.
|
default java.util.Spliterator<BikeyEntry<R,C,V>> |
spliterator() |
java.util.Collection<V> |
values()
Returns a
Collection view of the values contained in this map. |
V put(R row, C column, V value)
row
- row with which the specified value is to be associatedcolumn
- column with which the specified value is to be associatedvalue
- value to be associated with the specified bikeyjava.lang.NullPointerException
- if the specified bikey or value is nulldefault void putAll(BikeyMap<? extends R,? extends C,? extends V> m)
put(row, column, value)
on this map once for each mapping from
bikey row
and column
to value v
in the specified
map. The behavior of this operation is undefined if the specified map is
modified while the operation is in progress.m
- mappings to be stored in this mapjava.lang.NullPointerException
- if the specified map is null, or if the specified map
contains null keys or valuesjava.lang.IllegalArgumentException
- if some property of a key or value in the specified map
prevents it from being stored in this mapV get(R row, C column)
null
if this map contains no mapping for the bikey.row
- row whose associated value with column value is to be returnedcolumn
- column whose associated value with row value is to be returnednull
if this map contains no mapping for the keyjava.lang.NullPointerException
- if the specified row or column is nullV remove(R row, C column)
Returns the value to which this map previously associated the bikey, or null if the map contained no mapping for the key.
The map will not contain a mapping for the specified bikey once the call returns.
row
- row whose mapping is to be removed from the mapcolumn
- column whose mapping is to be removed from the mapjava.lang.NullPointerException
- if the specified bikey is null.int size()
void clear()
java.util.Set<Bikey<R,C>> keySet()
Set
view of the bikeys contained in this map. The set
is backed by the map, so changes to the map are reflected in the set, and
vice-versa. If the map is modified while an iteration over the set is in
progress, the results of the iteration are undefined.BikeySet<R,C> bikeySet()
BikeySet
view of the bikeys contained in this map. The
set is backed by the map, so changes to the map are reflected in the set.
If the map is modified while an iteration over the set is in progress,
the results of the iteration are undefined.java.util.Set<R> rowKeySet()
java.util.Set<C> columnKeySet()
java.util.Collection<V> values()
Collection
view of the values contained in this map.
The collection is backed by the map, so changes to the map are reflected
in the collection. If the map is modified while an iteration over the
collection is in progress, the results of the iteration are undefined.java.util.Set<BikeyEntry<R,C,V>> entrySet()
Set
view of the mappings contained in this map. The set
is backed by the map, so changes to the map are reflected in the set.boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- object to be compared for equality with this mapint hashCode()
Object.hashCode()
.hashCode
in class java.lang.Object
BikeyEntry.hashCode()
,
Object.equals(Object)
,
equals(Object)
void forEachBikey(java.util.function.BiConsumer<? super R,? super C> action)
action
- The action to be performed for each bikeyjava.lang.NullPointerException
- if the specified action is nulldefault void forEach(java.util.function.BiConsumer<Bikey<R,C>,? super V> action)
action
- The action to be performed for each entryjava.lang.NullPointerException
- if the specified action is nullvoid forEach(TriConsumer<? super R,? super C,? super V> action)
The action processes bikey as a TriConsumer
with a broken down
key.
action
- The action to be performed for each entryjava.lang.NullPointerException
- if the specified action is nulldefault java.util.Spliterator<BikeyEntry<R,C,V>> spliterator()
spliterator
in interface java.lang.Iterable<BikeyEntry<R,C,V>>
boolean containsValue(java.lang.Object value)
value
- value whose presence in this map is to be testedjava.lang.NullPointerException
- if the specified value is nullboolean containsRow(java.lang.Object row)
row
- key of row to search forboolean containsColumn(java.lang.Object column)
column
- key of column to search fordefault boolean isEmpty()
default boolean containsKey(R row, C column)
row
- row whose presence with column in this map are to be testedcolumn
- column whose presence with row in this map are to be testedjava.lang.NullPointerException
- if the specified row or column is nulldefault V getOrDefault(R row, C column, V defaultValue)
defaultValue
if this map contains no mapping for the bikey.row
- row whose associated value is to be returnedcolumn
- column whose associated value is to be returneddefaultValue
- the default mapping of the bikeydefaultValue
if this map contains no mapping for the
bikeydefault V putIfAbsent(R row, C column, V defaultValue)
null
, else returns the
current value.row
- row with which the specified value is to be associatedcolumn
- column with which the specified value is to be associateddefaultValue
- value to be associated with the specified keyjava.lang.NullPointerException
- if the specified keys or value is nulldefault boolean remove(R row, C column, java.lang.Object value)
row
- row with which the specified value is to be associatedcolumn
- column with which the specified value is to be associatedvalue
- value expected to be associated with the specified keytrue
if the value was removedjava.lang.NullPointerException
- if the specified keys or value is nulldefault boolean replace(R row, C column, V oldValue, V newValue)
row
- row with which the specified value is to be associatedcolumn
- column with which the specified value is to be associatedoldValue
- value expected to be associated with the specified bikeynewValue
- value to be associated with the specified bikeytrue
if the value was replacedjava.lang.NullPointerException
- if a specified key or newValue is nulljava.lang.NullPointerException
- if oldValue is nulldefault V replace(R row, C column, V value)
row
- row with which the specified value is to be associatedcolumn
- column with which the specified value is to be associatedvalue
- value to be associated with the specified keynull
if there was no mapping for the keyjava.lang.NullPointerException
- if the specified key or value is nulldefault V computeIfAbsent(R row, C column, java.util.function.BiFunction<R,C,? extends V> mappingFunction)
null
.
If the mapping function returns null
, no mapping is recorded. If
the mapping function itself throws an (unchecked) exception, the
exception is rethrown, and no mapping is recorded. The mapping function
should not modify this map during computation.
row
- row with which the specified value is to be associatedcolumn
- column with which the specified value is to be associatedmappingFunction
- the mapping function to compute a valuejava.lang.NullPointerException
- if the specified bikey is null or the mappingFunction is nulldefault V computeIfPresent(R row, C column, TriFunction<? super R,? super C,? super V,? extends V> remappingFunction)
If the remapping function returns null
, the mapping is removed.
If the remapping function itself throws an (unchecked) exception, the
exception is rethrown, and the current mapping is left unchanged.
The remapping function should not modify this map during computation.
row
- row with which the specified value is to be associatedcolumn
- column with which the specified value is to be associatedremappingFunction
- the remapping function to compute a valuejava.lang.NullPointerException
- if the specified bikey is null or the mappingFunction is nulldefault V compute(R row, C column, TriFunction<? super R,? super C,? super V,? extends V> remappingFunction)
null
if there is no current mapping.
If the function returns null
, the mapping is removed (or remains
absent if initially absent). If the function itself throws an (unchecked)
exception, the exception is rethrown, and the current mapping is left
unchanged.
row
- row with which the specified value is to be associatedcolumn
- column with which the specified value is to be associatedremappingFunction
- the function to compute a valuejava.lang.NullPointerException
- if the specified key is null or the remappingFunction is nulldefault V merge(R row, C column, V value, java.util.function.BiFunction<? super V,? super V,? extends V> remappingFunction)
null
. This method may be of use when combining multiple
mapped values for a bikey.
If the function returns null
the mapping is removed. If the
function itself throws an (unchecked) exception, the exception is
rethrown, and the current mapping is left unchanged.
row
- row with which the specified value is to be associatedcolumn
- column with which the specified value is to be associatedvalue
- the non-null value to be merged with the existing value
associated with the bikey or, if no existing value, to be
associated with the keyremappingFunction
- the function to recompute a value if presentjava.lang.NullPointerException
- if the specified key is null or the value or
remappingFunction is null