public interface CharShortMap extends Map<Character,Short>, Container
CharShortMapFactory
,
@KolobokeMap
Modifier and Type | Method and Description |
---|---|
short |
addValue(char key,
short 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. |
short |
addValue(char key,
short addition,
short 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. |
Short |
compute(Character key,
BiFunction<? super Character,? super Short,? extends Short> remappingFunction)
Deprecated.
Use specialization
compute(char, CharShortToShortFunction) instead |
short |
compute(char key,
CharShortToShortFunction remappingFunction)
Attempts to compute a mapping for the specified key and its current mapped value
(or default
value if there is no current mapping).
|
Short |
computeIfAbsent(Character key,
Function<? super Character,? extends Short> mappingFunction)
Deprecated.
Use specialization
computeIfAbsent(char, CharToShortFunction) instead |
short |
computeIfAbsent(char key,
CharToShortFunction 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
.
|
Short |
computeIfPresent(Character key,
BiFunction<? super Character,? super Short,? extends Short> remappingFunction)
Deprecated.
Use specialization
computeIfPresent(char, CharShortToShortFunction) instead |
short |
computeIfPresent(char key,
CharShortToShortFunction 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(char key)
Returns
true if this map contains a mapping for the specified key. |
boolean |
containsKey(Object key)
Deprecated.
Use specialization
containsKey(char) instead |
boolean |
containsValue(Object value)
Deprecated.
Use specialization
containsValue(short) instead |
boolean |
containsValue(short value)
Returns
true if this map maps one or more keys to the specified value. |
CharShortCursor |
cursor()
Returns a new cursor over the entries of this map.
|
short |
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<Character,Short>> |
entrySet() |
void |
forEach(BiConsumer<? super Character,? super Short> action)
Deprecated.
Use specialization
forEach(CharShortConsumer) instead |
void |
forEach(CharShortConsumer 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(CharShortPredicate 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 . |
short |
get(char key)
Returns the value to which the specified key is mapped, or default
value if this map
contains no mapping for the key.
|
Short |
get(Object key)
Deprecated.
Use specialization
get(char) instead |
short |
getOrDefault(char key,
short defaultValue)
Returns the value to which the specified key is mapped, or
defaultValue if this map
contains no mapping for the key. |
Short |
getOrDefault(Object key,
Short defaultValue)
Deprecated.
Use specialization
getOrDefault(char, short) instead |
CharSet |
keySet() |
Short |
merge(Character key,
Short value,
BiFunction<? super Short,? super Short,? extends Short> remappingFunction)
Deprecated.
Use specialization
merge(char, short, ShortBinaryOperator) instead |
short |
merge(char key,
short value,
ShortBinaryOperator 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.
|
Short |
put(Character key,
Short value)
Deprecated.
Use specialization
put(char, short) instead |
short |
put(char key,
short value)
Associates the specified value with the specified key in this map (optional operation).
|
Short |
putIfAbsent(Character key,
Short value)
Deprecated.
Use specialization
putIfAbsent(char, short) instead |
short |
putIfAbsent(char key,
short 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.
|
short |
remove(char key)
Removes the mapping for a key from this map if it is present (optional operation).
|
boolean |
remove(char key,
short value)
Removes the entry for the specified key only if it is currently mapped to the specified
value.
|
Short |
remove(Object key)
Deprecated.
Use specialization
remove(char) instead |
boolean |
remove(Object key,
Object value)
Deprecated.
Use specialization
remove(char, short) instead |
boolean |
removeIf(CharShortPredicate filter)
Removes all of the entries of this collection that satisfy the given predicate.
|
Short |
replace(Character key,
Short value)
Deprecated.
Use specialization
replace(char, short) instead |
boolean |
replace(Character key,
Short oldValue,
Short newValue)
Deprecated.
Use specialization
replace(char, short, short) instead |
short |
replace(char key,
short value)
Replaces the entry for the specified key only if it is currently mapped to some value.
|
boolean |
replace(char key,
short oldValue,
short newValue)
Replaces the entry for the specified key only if currently mapped to the specified value.
|
void |
replaceAll(BiFunction<? super Character,? super Short,? extends Short> function)
Deprecated.
Use specialization
replaceAll(CharShortToShortFunction) instead |
void |
replaceAll(CharShortToShortFunction 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.
|
ShortCollection |
values() |
clear, ensureCapacity, isEmpty, shrink, size, sizeAsLong
short defaultValue()
null
in primitive specialization methods, when the key is absent in the map.CharShortMapFactory.withDefaultValue(short)
@Deprecated boolean containsKey(Object key)
containsKey(char)
insteadcontainsKey
in interface Map<Character,Short>
boolean containsKey(char key)
true
if this map contains a mapping for the specified key.key
- the char
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(short)
insteadcontainsValue
in interface Map<Character,Short>
boolean containsValue(short 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 CharShortMap
interface.value
- the short
value whose presence in this map is to be testedtrue
if this map maps one or more keys to the specified value@Nullable @Deprecated Short get(Object key)
get(char)
insteadshort get(char key)
key
- the key whose associated value is to be returned@Deprecated Short getOrDefault(Object key, Short defaultValue)
getOrDefault(char, short)
insteadgetOrDefault
in interface Map<Character,Short>
short getOrDefault(char key, short 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 Character,? super Short> action)
forEach(CharShortConsumer)
insteadvoid forEach(@Nonnull CharShortConsumer 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 CharShortPredicate 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 CharShortCursor cursor()
Basic cursor usage idiom is:
for (CharShortCursor cur = map.cursor(); cur.moveNext();) {
// Work with cur.key() and cur.value()
// Call cur.remove() to remove the current entry
}
@Deprecated Short put(Character key, Short value)
put(char, short)
insteadshort put(char key, short 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 Short putIfAbsent(Character key, Short value)
putIfAbsent(char, short)
insteadnull
, else returns the current value.putIfAbsent
in interface Map<Character,Short>
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 mapshort putIfAbsent(char key, short 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 Short compute(Character key, @Nonnull BiFunction<? super Character,? super Short,? extends Short> remappingFunction)
compute(char, CharShortToShortFunction)
insteadshort compute(char key, @Nonnull CharShortToShortFunction 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 Short computeIfAbsent(Character key, @Nonnull Function<? super Character,? extends Short> mappingFunction)
computeIfAbsent(char, CharToShortFunction)
insteadcomputeIfAbsent
in interface Map<Character,Short>
short computeIfAbsent(char key, @Nonnull CharToShortFunction 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 Short computeIfPresent(Character key, @Nonnull BiFunction<? super Character,? super Short,? extends Short> remappingFunction)
computeIfPresent(char, CharShortToShortFunction)
insteadcomputeIfPresent
in interface Map<Character,Short>
short computeIfPresent(char key, @Nonnull CharShortToShortFunction 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 Short merge(Character key, Short value, @Nonnull BiFunction<? super Short,? super Short,? extends Short> remappingFunction)
merge(char, short, ShortBinaryOperator)
insteadshort merge(char key, short value, @Nonnull ShortBinaryOperator 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 mapshort addValue(char key, short 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 mapshort addValue(char key, short addition, short 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(char, short)
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 Short replace(Character key, Short value)
replace(char, short)
insteadreplace
in interface Map<Character,Short>
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 mapshort replace(char key, short 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(Character key, Short oldValue, Short newValue)
replace(char, short, short)
insteadreplace
in interface Map<Character,Short>
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(char key, short oldValue, short 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 Character,? super Short,? extends Short> function)
replaceAll(CharShortToShortFunction)
insteadreplaceAll
in interface Map<Character,Short>
void replaceAll(@Nonnull CharShortToShortFunction 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 Short remove(Object key)
remove(char)
insteadshort remove(char 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(char, short)
insteadremove
in interface Map<Character,Short>
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(char key, short 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 CharShortPredicate 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.