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