public interface IntByteMap extends Map<Integer,Byte>, Container
IntByteMapFactory
,
@KolobokeMap
Modifier and Type | Method and Description |
---|---|
byte |
addValue(int key,
byte addition)
Adds the given value
addition to the value associated with the specified key,
or to the default value if this map contains no mapping for
the key, and associates the resulting value with the key. |
byte |
addValue(int key,
byte addition,
byte initialValue)
Adds the given value
addition to the value associated with the specified key,
or the given initialValue if this map contains no mapping for the key, and associates
the resulting value with the key. |
Byte |
compute(Integer key,
BiFunction<? super Integer,? super Byte,? extends Byte> remappingFunction)
Deprecated.
Use specialization
compute(int, IntByteToByteFunction) instead |
byte |
compute(int key,
IntByteToByteFunction remappingFunction)
Attempts to compute a mapping for the specified key and its current mapped value
(or default
value if there is no current mapping).
|
Byte |
computeIfAbsent(Integer key,
Function<? super Integer,? extends Byte> mappingFunction)
Deprecated.
Use specialization
computeIfAbsent(int, IntToByteFunction) instead |
byte |
computeIfAbsent(int key,
IntToByteFunction mappingFunction)
If the specified key is not already associated with a value, attempts
to compute its value using the given mapping function and enters it into this map
.
|
Byte |
computeIfPresent(Integer key,
BiFunction<? super Integer,? super Byte,? extends Byte> remappingFunction)
Deprecated.
Use specialization
computeIfPresent(int, IntByteToByteFunction) instead |
byte |
computeIfPresent(int key,
IntByteToByteFunction remappingFunction)
If the value for the specified key is present,
attempts to compute a new mapping given the key and its current mapped value.
|
boolean |
containsKey(int key)
Returns
true if this map contains a mapping for the specified key. |
boolean |
containsKey(Object key)
Deprecated.
Use specialization
containsKey(int) instead |
boolean |
containsValue(byte value)
Returns
true if this map maps one or more keys to the specified value. |
boolean |
containsValue(Object value)
Deprecated.
Use specialization
containsValue(byte) instead |
IntByteCursor |
cursor()
Returns a new cursor over the entries of this map.
|
byte |
defaultValue()
Returns the default value of this map, which is used instead of
null
in primitive specialization methods, when the key is absent in the map. |
ObjSet<Map.Entry<Integer,Byte>> |
entrySet() |
void |
forEach(BiConsumer<? super Integer,? super Byte> action)
Deprecated.
Use specialization
forEach(IntByteConsumer) instead |
void |
forEach(IntByteConsumer action)
Performs the given
action on each entry in this map until all entries
have been processed or the action throws an Exception . |
boolean |
forEachWhile(IntBytePredicate predicate)
Checks the given
predicate on each entry in this map until all entries
have been processed or the predicate returns false for some entry,
or throws an Exception . |
byte |
get(int key)
Returns the value to which the specified key is mapped, or default
value if this map
contains no mapping for the key.
|
Byte |
get(Object key)
Deprecated.
Use specialization
get(int) instead |
byte |
getOrDefault(int key,
byte defaultValue)
Returns the value to which the specified key is mapped, or
defaultValue if this map
contains no mapping for the key. |
Byte |
getOrDefault(Object key,
Byte defaultValue)
Deprecated.
Use specialization
getOrDefault(int, byte) instead |
IntSet |
keySet() |
byte |
merge(int key,
byte value,
ByteBinaryOperator remappingFunction)
If the specified key is not already associated with a value, associates
it with the given value, otherwise, replaces the value with the results of the given
remapping function.
|
Byte |
merge(Integer key,
Byte value,
BiFunction<? super Byte,? super Byte,? extends Byte> remappingFunction)
Deprecated.
Use specialization
merge(int, byte, ByteBinaryOperator) instead |
byte |
put(int key,
byte value)
Associates the specified value with the specified key in this map (optional operation).
|
Byte |
put(Integer key,
Byte value)
Deprecated.
Use specialization
put(int, byte) instead |
byte |
putIfAbsent(int key,
byte value)
If the specified key is not already associated with a value, associates
it with the given value and returns default
value, else returns the current value.
|
Byte |
putIfAbsent(Integer key,
Byte value)
Deprecated.
Use specialization
putIfAbsent(int, byte) instead |
byte |
remove(int key)
Removes the mapping for a key from this map if it is present (optional operation).
|
boolean |
remove(int key,
byte value)
Removes the entry for the specified key only if it is currently mapped to the specified
value.
|
Byte |
remove(Object key)
Deprecated.
Use specialization
remove(int) instead |
boolean |
remove(Object key,
Object value)
Deprecated.
Use specialization
remove(int, byte) instead |
boolean |
removeIf(IntBytePredicate filter)
Removes all of the entries of this collection that satisfy the given predicate.
|
byte |
replace(int key,
byte value)
Replaces the entry for the specified key only if it is currently mapped to some value.
|
boolean |
replace(int key,
byte oldValue,
byte newValue)
Replaces the entry for the specified key only if currently mapped to the specified value.
|
Byte |
replace(Integer key,
Byte value)
Deprecated.
Use specialization
replace(int, byte) instead |
boolean |
replace(Integer key,
Byte oldValue,
Byte newValue)
Deprecated.
Use specialization
replace(int, byte, byte) instead |
void |
replaceAll(BiFunction<? super Integer,? super Byte,? extends Byte> function)
Deprecated.
Use specialization
replaceAll(IntByteToByteFunction) instead |
void |
replaceAll(IntByteToByteFunction function)
Replaces each entry's value with the result of invoking the given function on that entry,
in the order entries are returned by an entry set iterator, until all entries have been
processed or the function throws an exception.
|
ByteCollection |
values() |
clear, ensureCapacity, isEmpty, shrink, size, sizeAsLong
byte defaultValue()
null
in primitive specialization methods, when the key is absent in the map.IntByteMapFactory.withDefaultValue(byte)
@Deprecated boolean containsKey(Object key)
containsKey(int)
insteadcontainsKey
in interface Map<Integer,Byte>
boolean containsKey(int key)
true
if this map contains a mapping for the specified key.key
- the int
key whose presence in this map is to be testedtrue
if this map contains a mapping for the specified key@Deprecated boolean containsValue(Object value)
containsValue(byte)
insteadcontainsValue
in interface Map<Integer,Byte>
boolean containsValue(byte value)
true
if this map maps one or more keys to the specified value. This operation
will probably require time linear in the map size for most implementations
of the IntByteMap
interface.value
- the byte
value whose presence in this map is to be testedtrue
if this map maps one or more keys to the specified value@Nullable @Deprecated Byte get(Object key)
get(int)
insteadbyte get(int key)
key
- the key whose associated value is to be returned@Deprecated Byte getOrDefault(Object key, Byte defaultValue)
getOrDefault(int, byte)
insteadgetOrDefault
in interface Map<Integer,Byte>
byte getOrDefault(int key, byte defaultValue)
defaultValue
if this map
contains no mapping for the key.key
- the key whose associated value is to be returneddefaultValue
- the value to return if the specified key
is absent in the mapdefaultValue
if this map contains no mapping for the key@Deprecated void forEach(@Nonnull BiConsumer<? super Integer,? super Byte> action)
forEach(IntByteConsumer)
insteadvoid forEach(@Nonnull IntByteConsumer action)
action
on each entry in this map until all entries
have been processed or the action throws an Exception
.
Exceptions thrown by the action are relayed to the caller. The entries
will be processed in the same order as the entry set iterator unless that
order is unspecified in which case implementations may use an order which
differs from the entry set iterator.action
- The action to be performed for each entryboolean forEachWhile(@Nonnull IntBytePredicate predicate)
predicate
on each entry in this map until all entries
have been processed or the predicate returns false
for some entry,
or throws an Exception
. Exceptions thrown by the predicate are relayed to the caller.
The entries will be processed in the same order as the entry set iterator unless that order is unspecified in which case implementations may use an order which differs from the entry set iterator.
If the map is empty, this method returns true
immediately.
predicate
- the predicate to be checked for each entrytrue
if the predicate returned true
for all entries of the map,
false
if it returned false
for the entry@Nonnull IntByteCursor cursor()
Basic cursor usage idiom is:
for (IntByteCursor cur = map.cursor(); cur.moveNext();) {
// Work with cur.key() and cur.value()
// Call cur.remove() to remove the current entry
}
@Deprecated Byte put(Integer key, Byte value)
put(int, byte)
insteadbyte put(int key, byte value)
m
is said to contain a mapping for a key k
if and only if m.containsKey(k)
would return true
.)key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keykey
, or default
value if there was
no mapping for key
. (A default
value return can also indicate that the map
previously associated default
value with key
.)UnsupportedOperationException
- if the put
operation
is not supported by this mapIllegalArgumentException
- if some property of a specified key
or value prevents it from being stored in this map@Nullable @Deprecated Byte putIfAbsent(Integer key, Byte value)
putIfAbsent(int, byte)
insteadnull
, else returns the current value.putIfAbsent
in interface Map<Integer,Byte>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keynull
if there was no mapping for the key.
(A null
return can also indicate that the map
previously associated null
with the key,
if the implementation supports null values.)UnsupportedOperationException
- if the put
operation
is not supported by this mapClassCastException
- if the key or value is of an inappropriate type for this mapNullPointerException
- if the specified key or value is nullIllegalArgumentException
- if some property of the specified key
or value prevents it from being stored in this mapbyte putIfAbsent(int key, byte value)
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified keyUnsupportedOperationException
- if the put
operation
is not supported by this mapIllegalArgumentException
- if some property of a specified key
or value prevents it from being stored in this map@Deprecated Byte compute(Integer key, @Nonnull BiFunction<? super Integer,? super Byte,? extends Byte> remappingFunction)
compute(int, IntByteToByteFunction)
insteadbyte compute(int key, @Nonnull IntByteToByteFunction remappingFunction)
If the function itself throws an (unchecked) exception, the exception is rethrown, and the current mapping is left unchanged.
key
- key with which the specified value is to be associatedremappingFunction
- the function to compute a valueUnsupportedOperationException
- if the put
operation
is not supported by this map@Deprecated Byte computeIfAbsent(Integer key, @Nonnull Function<? super Integer,? extends Byte> mappingFunction)
computeIfAbsent(int, IntToByteFunction)
insteadcomputeIfAbsent
in interface Map<Integer,Byte>
byte computeIfAbsent(int key, @Nonnull IntToByteFunction mappingFunction)
If the function itself throws an (unchecked) exception, the exception is rethrown, and no mapping is recorded.
key
- key with which the specified value is to be associatedmappingFunction
- the function to compute a valueUnsupportedOperationException
- if the put
operation
is not supported by this map@Deprecated Byte computeIfPresent(Integer key, @Nonnull BiFunction<? super Integer,? super Byte,? extends Byte> remappingFunction)
computeIfPresent(int, IntByteToByteFunction)
insteadcomputeIfPresent
in interface Map<Integer,Byte>
byte computeIfPresent(int key, @Nonnull IntByteToByteFunction remappingFunction)
If the function itself throws an (unchecked) exception, the exception is rethrown, and the current mapping is left unchanged.
key
- key with which the specified value is to be associatedremappingFunction
- the function to compute a valueUnsupportedOperationException
- if the put
operation
is not supported by this map@Deprecated Byte merge(Integer key, Byte value, @Nonnull BiFunction<? super Byte,? super Byte,? extends Byte> remappingFunction)
merge(int, byte, ByteBinaryOperator)
insteadbyte merge(int key, byte value, @Nonnull ByteBinaryOperator remappingFunction)
If the remappingFunction itself throws an (unchecked) exception, the exception is rethrown, and the current mapping is left unchanged.
key
- key with which the specified value is to be associatedvalue
- the value to use if absentremappingFunction
- the function to recompute a value if presentNullPointerException
- if the remappingFunction
is nullUnsupportedOperationException
- if the put
operation
is not supported by this mapbyte addValue(int key, byte addition)
addition
to the value associated with the specified key,
or to the default value if this map contains no mapping for
the key, and associates the resulting value with the key.key
- the key to which value add the given valueaddition
- the value additionUnsupportedOperationException
- if the put
operation
is not supported by this mapbyte addValue(int key, byte addition, byte initialValue)
addition
to the value associated with the specified key,
or the given initialValue
if this map contains no mapping for the key, and associates
the resulting value with the key.
This version of addValue(int, byte)
method is useful if you want
to accumulate values from the different initial value, than the default value of this map.
key
- the key to which value add the given valueaddition
- the value additioninitialValue
- the value to add the given value addition
to, if the map contains
no mapping for the given keyUnsupportedOperationException
- if the put
operation
is not supported by this map@Nullable @Deprecated Byte replace(Integer key, Byte value)
replace(int, byte)
insteadreplace
in interface Map<Integer,Byte>
key
- key with which the specified value is associatedvalue
- value to be associated with the specified keynull
if there was
no mapping for the key.UnsupportedOperationException
- if the put
operation
is not supported by this mapNullPointerException
- if the specified key or value is nullIllegalArgumentException
- if some property of the specified value
prevents it from being stored in this mapbyte replace(int key, byte value)
key
- key with which the specified value is associatedvalue
- value to be associated with the specified keyIllegalArgumentException
- if some property of a specified key
or value prevents it from being stored in this mapUnsupportedOperationException
- if the put
operation
is not supported by this map@Deprecated boolean replace(Integer key, Byte oldValue, Byte newValue)
replace(int, byte, byte)
insteadreplace
in interface Map<Integer,Byte>
key
- key with which the specified value is associatedoldValue
- value expected to be associated with the specified keynewValue
- value to be associated with the specified keytrue
if the value was replacedUnsupportedOperationException
- if the put
operation
is not supported by this mapNullPointerException
- if the specified key or value is nullIllegalArgumentException
- if some property of the specified value
prevents it from being stored in this mapboolean replace(int key, byte oldValue, byte newValue)
key
- key with which the specified value is associatedoldValue
- value expected to be associated with the specified keynewValue
- value to be associated with the specified keytrue
if the value was replacedIllegalArgumentException
- if some property of a specified key
or value prevents it from being stored in this mapUnsupportedOperationException
- if the put
operation
is not supported by this map@Deprecated void replaceAll(@Nonnull BiFunction<? super Integer,? super Byte,? extends Byte> function)
replaceAll(IntByteToByteFunction)
insteadreplaceAll
in interface Map<Integer,Byte>
void replaceAll(@Nonnull IntByteToByteFunction function)
function
- the function to apply to each entryUnsupportedOperationException
- if the set
operation
is not supported by this map's entry set iteratorIllegalArgumentException
- if some property of a replacement value
prevents it from being stored in this map (optional restriction)@Nullable @Deprecated Byte remove(Object key)
remove(int)
insteadbyte remove(int key)
Returns the value to which this map previously associated the key, or default value if the map contained no mapping for the key.
A return value of default value does not necessarily indicate that the map contained no mapping for the key; it's also possible that the map explicitly mapped the key to default value.
The map will not contain a mapping for the specified key once the call returns.
key
- key whose mapping is to be removed from the mapkey
, or default
value if there was
no mapping for key
UnsupportedOperationException
- if the remove
operation
is not supported by this map@Deprecated boolean remove(Object key, Object value)
remove(int, byte)
insteadremove
in interface Map<Integer,Byte>
key
- key with which the specified value is associatedvalue
- value expected to be associated with the specified keytrue
if the value was removedNullPointerException
- if the specified key or value is nullUnsupportedOperationException
- if the remove
operation
is not supported by this mapboolean remove(int key, byte value)
key
- key with which the specified value is associatedvalue
- value expected to be associated with the specified keytrue
if the value was removedUnsupportedOperationException
- if the remove
operation
is not supported by this mapboolean removeIf(@Nonnull IntBytePredicate filter)
filter
- a predicate which returns true
for elements to be removedtrue
if any elements were removedNullPointerException
- if the specified filter is nullUnsupportedOperationException
- if elements cannot be removed from this collection.
Implementations may throw this exception if a matching element cannot be removed
or if, in general, removal is not supported.