|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ObjFloatMap<K>
A Map specialization with Object keys and float values.
ObjFloatMapFactory| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Method Summary | |
|---|---|
float |
addValue(K key,
float addition)
Adds the given addition value to the value associated with the specified key,
or default value if this map contains no mapping for the key, and associates the resulting
value with the key. |
float |
addValue(K key,
float addition,
float defaultValue)
Adds the given addition value to the value associated with the specified key,
or defaultValue if this map contains no mapping for the key, and associates
the resulting value with the key. |
float |
compute(K key,
ObjFloatToFloatFunction<? super K> remappingFunction)
Attempts to compute a mapping for the specified key and its current mapped value (or default value if there is no current mapping). |
float |
computeIfAbsent(K key,
ToFloatFunction<? super K> 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 . |
float |
computeIfPresent(K key,
ObjFloatToFloatFunction<? super K> 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 |
containsValue(float value)
Returns true if this map maps one or more keys to the specified value. |
boolean |
containsValue(Object value)
Deprecated. Use specialization containsValue(float) instead |
ObjFloatCursor<K> |
cursor()
Returns a new cursor over the entries of this map. |
float |
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<K,Float>> |
entrySet()
|
void |
forEach(ObjFloatConsumer<? super K> 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(ObjFloatPredicate<? super K> 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. |
Float |
get(Object key)
Deprecated. Use specialization getFloat(Object) instead |
float |
getFloat(Object key)
Returns the value to which the specified key is mapped, or default value if this map
contains no mapping for the key. |
float |
getOrDefault(Object key,
float defaultValue)
Returns the value to which the specified key is mapped, or defaultValue if this map
contains no mapping for the key. |
Float |
getOrDefault(Object key,
Float defaultValue)
Deprecated. Use specialization getOrDefault(Object, float) instead |
Equivalence<K> |
keyEquivalence()
Returns the equivalence strategy for keys in this map. |
ObjSet<K> |
keySet()
|
float |
merge(K key,
float value,
FloatBinaryOperator 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. |
float |
put(K key,
float value)
Associates the specified value with the specified key in this map (optional operation). |
Float |
put(K key,
Float value)
Deprecated. Use specialization put(Object, float) instead |
float |
putIfAbsent(K key,
float 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. |
Float |
putIfAbsent(K key,
Float value)
Deprecated. Use specialization putIfAbsent(Object, float) instead |
Float |
remove(Object key)
Deprecated. Use specialization removeAsFloat(Object) instead |
boolean |
remove(Object key,
float value)
Removes the entry for the specified key only if it is currently mapped to the specified value. |
boolean |
remove(Object key,
Object value)
Deprecated. Use specialization remove(Object, float) instead |
float |
removeAsFloat(Object key)
Removes the mapping for a key from this map if it is present (optional operation). |
boolean |
removeIf(ObjFloatPredicate<? super K> filter)
Removes all of the entries of this collection that satisfy the given predicate. |
float |
replace(K key,
float value)
Replaces the entry for the specified key only if it is currently mapped to some value. |
Float |
replace(K key,
Float value)
Deprecated. Use specialization replace(Object, float) instead |
boolean |
replace(K key,
float oldValue,
float newValue)
Replaces the entry for the specified key only if currently mapped to the specified value. |
boolean |
replace(K key,
Float oldValue,
Float newValue)
Deprecated. Use specialization replace(Object, float, float) instead |
void |
replaceAll(ObjFloatToFloatFunction<? super K> 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. |
FloatCollection |
values()
|
| Methods inherited from interface java.util.Map |
|---|
clear, containsKey, equals, hashCode, isEmpty, putAll, size |
| Methods inherited from interface net.openhft.collect.Container |
|---|
clear, ensureCapacity, isEmpty, shrink, size, sizeAsLong |
| Method Detail |
|---|
@Nullable Equivalence<K> keyEquivalence()
Map
interface which defined in terms of Object.equals(Object) equality of key objects
(almost all methods, actually), are supposed to use this equivalence instead.
null if it is the default Object equalityHashObjFloatMapFactory.withKeyEquivalence(net.openhft.collect.Equivalence) float defaultValue()
null
in primitive specialization methods, when the key is absent in the map.
ObjFloatMapFactory.withDefaultValue(float)@Deprecated boolean containsValue(Object value)
containsValue(float) instead
containsValue in interface Map<K,Float>boolean containsValue(float 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 ObjFloatMap interface.
value - the float value whose presence in this map is to be tested
true if this map maps one or more keys to the specified value@Nullable @Deprecated Float get(Object key)
getFloat(Object) instead
get in interface Map<K,Float>float getFloat(Object key)
default value if this map
contains no mapping for the key.
More formally, if this map contains a mapping from a key k to a value v
such that keyEquivalence() == null ? (key==null ? k==null : key.equals(k)) :
keyEquivalence().nullableEquivalent(k, key), then this method returns v; otherwise
it returns default value. (There can be at most one such mapping.)
key - the key whose associated value is to be returned
default value if this map
contains no mapping for the key
ClassCastException - if the key is of an inappropriate type for
this map (optional restriction)
NullPointerException - if the specified key is null and this map does not permit
null keys (optional restriction)
@Deprecated
Float getOrDefault(Object key,
Float defaultValue)
getOrDefault(Object, float) instead
defaultValue if this map contains no mapping for the key.
key - the key whose associated value is to be returneddefaultValue - the default mapping of the key
defaultValue if this map contains no mapping for the key
ClassCastException - if the key is of an inappropriate type for
this map (optional restriction)
NullPointerException - if the specified key is null and this map
does not permit null keys (optional restriction)
float getOrDefault(Object key,
float defaultValue)
defaultValue if this map
contains no mapping for the key.
key - the key whose associated value is to be returned
defaultValue if this map contains no mapping for the key
ClassCastException - if the key is of an inappropriate type for
this map (optional restriction)
NullPointerException - if the specified key is null and this map
does not permit null keys (optional restriction)
void forEach(@Nonnull
ObjFloatConsumer<? super K> 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 entry
boolean forEachWhile(@Nonnull
ObjFloatPredicate<? super K> 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 entry
true if the predicate returned true for all entries of the map,
false if it returned false for the entry@Nonnull ObjFloatCursor<K> cursor()
@Nonnull ObjSet<K> keySet()
keySet in interface Map<K,Float>@Nonnull FloatCollection values()
values in interface Map<K,Float>@Nonnull ObjSet<Map.Entry<K,Float>> entrySet()
entrySet in interface Map<K,Float>
@Deprecated
Float put(K key,
Float value)
put(Object, float) instead
put in interface Map<K,Float>
float put(K key,
float 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 key
key, 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 map
ClassCastException - if the class of the specified key
prevents it from being stored in this map
NullPointerException - if the specified key is null,
and this map does not permit null keys
IllegalArgumentException - if some property of a specified key
or value prevents it from being stored in this map
@Nullable
@Deprecated
Float putIfAbsent(K key,
Float value)
putIfAbsent(Object, float) instead
null, else returns the current value.
key - key with which the specified value is to be associatedvalue - value to be associated with the specified key
null 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 map
ClassCastException - if the key or value is of an inappropriate type for this map
NullPointerException - if the specified value is null
IllegalArgumentException - if some property of the specified key
or value prevents it from being stored in this map
float putIfAbsent(K key,
float value)
default value, else returns the current value.
key - key with which the specified value is to be associatedvalue - value to be associated with the specified key
default value
if there was no mapping for the key. (A default value return
can also indicate that the map previously associated default value
with the key, if the implementation supports such values.)
UnsupportedOperationException - if the put operation
is not supported by this map
ClassCastException - if the class of the specified key
prevents it from being stored in this map
NullPointerException - if the specified key is null,
and this map does not permit null keys
IllegalArgumentException - if some property of a specified key
or value prevents it from being stored in this map
float compute(K key,
@Nonnull
ObjFloatToFloatFunction<? super K> remappingFunction)
default value if there is no current mapping).
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 value
ClassCastException - if the class of the
specified key
prevents it from being stored in this map (optional restriction)
UnsupportedOperationException - if the put operation
is not supported by this map
float computeIfAbsent(K key,
@Nonnull
ToFloatFunction<? super K> 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 value
ClassCastException - if the class of the
specified key
prevents it from being stored in this map (optional restriction)
UnsupportedOperationException - if the put operation
is not supported by this map
float computeIfPresent(K key,
@Nonnull
ObjFloatToFloatFunction<? super K> 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 value
ClassCastException - if the class of the
specified key
prevents it from being stored in this map (optional restriction)
UnsupportedOperationException - if the put operation
is not supported by this map
float merge(K key,
float value,
@Nonnull
FloatBinaryOperator 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 present
NullPointerException - if the remappingFunction is null
or if the specified key is null and this map does not support null keys
or if the specified value is null and this map does not support null values
ClassCastException - if the class of the
specified key
prevents it from being stored in this map (optional restriction)
UnsupportedOperationException - if the put operation
is not supported by this map
float addValue(K key,
float addition)
addition value to the value associated with the specified key,
or 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 to add
ClassCastException - if the class of the
specified key
prevents it from being stored in this map (optional restriction)
UnsupportedOperationException - if the put operation
is not supported by this map
float addValue(K key,
float addition,
float defaultValue)
addition value to the value associated with the specified key,
or defaultValue if this map contains no mapping for the key, and associates
the resulting value with the key.
This version of addValue(Object, float) is useful if you want to count
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 to adddefaultValue - the value to be used if the map contains no mapping for the given key
ClassCastException - if the class of the
specified key
prevents it from being stored in this map (optional restriction)
UnsupportedOperationException - if the put operation
is not supported by this map
@Nullable
@Deprecated
Float replace(K key,
Float value)
replace(Object, float) instead
key - key with which the specified value is associatedvalue - value to be associated with the specified key
null if there was
no mapping for the key.
UnsupportedOperationException - if the put operation
is not supported by this map
NullPointerException - if the specified value is null
IllegalArgumentException - if some property of the specified value
prevents it from being stored in this map
float replace(K key,
float value)
key - key with which the specified value is associatedvalue - value to be associated with the specified key
default value if there was no mapping for the key.
(A default value return can also indicate that the map
previously associated default value with the key,
if the implementation supports such values.)
ClassCastException - if the class of the specified key
prevents it from being stored in this map
NullPointerException - if the specified key is null,
and this map does not permit null keys
IllegalArgumentException - if some property of a specified key
or value prevents it from being stored in this map
UnsupportedOperationException - if the put operation
is not supported by this map
@Deprecated
boolean replace(K key,
Float oldValue,
Float newValue)
replace(Object, float, float) instead
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 key
true if the value was replaced
UnsupportedOperationException - if the put operation
is not supported by this map
NullPointerException - if the specified value is null
IllegalArgumentException - if some property of the specified value
prevents it from being stored in this map
boolean replace(K key,
float oldValue,
float 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 key
true if the value was replaced
ClassCastException - if the class of the specified key
prevents it from being stored in this map
NullPointerException - if the specified key is null,
and this map does not permit null keys
IllegalArgumentException - if some property of a specified key
or value prevents it from being stored in this map
UnsupportedOperationException - if the put operation
is not supported by this map
void replaceAll(@Nonnull
ObjFloatToFloatFunction<? super K> function)
function - the function to apply to each entry
UnsupportedOperationException - if the set operation
is not supported by this map's entry set iterator
IllegalArgumentException - if some property of a replacement value
prevents it from being stored in this map (optional restriction)@Nullable @Deprecated Float remove(Object key)
removeAsFloat(Object) instead
remove in interface Map<K,Float>float removeAsFloat(Object key)
More formally, if this map contains a mapping from a key k to a value v
such that keyEquivalence() == null ? (key==null ? k==null : key.equals(k)) :
keyEquivalence().nullableEquivalent(k, key), that mapping is removed.
(The map can contain at most one such mapping.)
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 map
key, or default value if there was
no mapping for key
ClassCastException - if the class of the specified key
prevents it from being stored in this map (optional restriction)
NullPointerException - if the specified key is null,
and this map does not permit null keys (optional restriction)
UnsupportedOperationException - if the remove operation
is not supported by this map
@Deprecated
boolean remove(Object key,
Object value)
remove(Object, float) instead
key - key with which the specified value is associatedvalue - value expected to be associated with the specified key
true if the value was removed
NullPointerException - if the specified value is null
, or if the specified key is null,
and this map does not permit null keys (optional restriction)
ClassCastException - if the class of the specified key
prevents it from being stored in this map (optional restriction)
UnsupportedOperationException - if the remove operation
is not supported by this map
boolean remove(Object key,
float value)
key - key with which the specified value is associatedvalue - value expected to be associated with the specified key
true if the value was removed
ClassCastException - if the class of the specified key
prevents it from being stored in this map (optional restriction)
NullPointerException - if the specified key is null,
and this map does not permit null keys (optional restriction)
UnsupportedOperationException - if the remove operation
is not supported by this map
boolean removeIf(@Nonnull
ObjFloatPredicate<? super K> filter)
filter - a predicate which returns true for elements to be removed
true if any elements were removed
NullPointerException - if the specified filter is null
UnsupportedOperationException - 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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||