|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FloatCharMap
A Map
specialization with float
keys and char
values.
FloatCharMapFactory
,
@KolobokeMap
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface Map |
---|
Map.Entry<K,V> |
Method Summary | |
---|---|
char |
addValue(float key,
char 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. |
char |
addValue(float key,
char addition,
char 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. |
char |
compute(float key,
FloatCharToCharFunction remappingFunction)
Attempts to compute a mapping for the specified key and its current mapped value (or default value if there is no current mapping). |
char |
computeIfAbsent(float key,
FloatToCharFunction 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 . |
char |
computeIfPresent(float key,
FloatCharToCharFunction 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(float key)
Returns true if this map contains a mapping for the specified key. |
boolean |
containsKey(Object key)
Deprecated. Use specialization containsKey(float) instead |
boolean |
containsValue(char value)
Returns true if this map maps one or more keys to the specified value. |
boolean |
containsValue(Object value)
Deprecated. Use specialization containsValue(char) instead |
FloatCharCursor |
cursor()
Returns a new cursor over the entries of this map. |
char |
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<Float,Character>> |
entrySet()
Returns a Set view of the mappings contained in this map. |
void |
forEach(FloatCharConsumer 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(FloatCharPredicate 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 . |
char |
get(float key)
Returns the value to which the specified key is mapped, or default value if this map contains no mapping for the key. |
Character |
get(Object key)
Deprecated. Use specialization get(float) instead |
char |
getOrDefault(float key,
char defaultValue)
Returns the value to which the specified key is mapped, or defaultValue if this map
contains no mapping for the key. |
Character |
getOrDefault(Object key,
Character defaultValue)
Deprecated. Use specialization getOrDefault(float, char) instead |
FloatSet |
keySet()
Returns a Set view of the keys contained in this map. |
char |
merge(float key,
char value,
CharBinaryOperator 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. |
char |
put(float key,
char value)
Associates the specified value with the specified key in this map (optional operation). |
Character |
put(Float key,
Character value)
Deprecated. Use specialization put(float, char) instead |
char |
putIfAbsent(float key,
char 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. |
Character |
putIfAbsent(Float key,
Character value)
Deprecated. Use specialization putIfAbsent(float, char) instead |
char |
remove(float key)
Removes the mapping for a key from this map if it is present (optional operation). |
boolean |
remove(float key,
char value)
Removes the entry for the specified key only if it is currently mapped to the specified value. |
Character |
remove(Object key)
Deprecated. Use specialization remove(float) instead |
boolean |
remove(Object key,
Object value)
Deprecated. Use specialization remove(float, char) instead |
boolean |
removeIf(FloatCharPredicate filter)
Removes all of the entries of this collection that satisfy the given predicate. |
char |
replace(float key,
char value)
Replaces the entry for the specified key only if it is currently mapped to some value. |
Character |
replace(Float key,
Character value)
Deprecated. Use specialization replace(float, char) instead |
boolean |
replace(Float key,
Character oldValue,
Character newValue)
Deprecated. Use specialization replace(float, char, char) instead |
boolean |
replace(float key,
char oldValue,
char newValue)
Replaces the entry for the specified key only if currently mapped to the specified value. |
void |
replaceAll(FloatCharToCharFunction 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. |
CharCollection |
values()
Returns a Collection view of the values contained in this map. |
Methods inherited from interface Map |
---|
clear, equals, hashCode, isEmpty, putAll, size |
Methods inherited from interface com.koloboke.collect.Container |
---|
clear, ensureCapacity, isEmpty, shrink, size, sizeAsLong |
Method Detail |
---|
char defaultValue()
null
in primitive specialization methods, when the key is absent in the map.
FloatCharMapFactory.withDefaultValue(char)
@Deprecated boolean containsKey(Object key)
containsKey(float)
instead
containsKey
in interface Map<Float,Character>
key
- key whose presence in this map is to be tested
boolean containsKey(float key)
true
if this map contains a mapping for the specified key.
key
- the float
key whose presence in this map is to be tested
true
if this map contains a mapping for the specified key@Deprecated boolean containsValue(Object value)
containsValue(char)
instead
containsValue
in interface Map<Float,Character>
value
- value whose presence in this map is to be tested
boolean containsValue(char 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 FloatCharMap
interface.
value
- the char
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 Character get(Object key)
get(float)
instead
null
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 (key==null ? k==null :
key.equals(k))
, then this method returns v
; otherwise
it returns null
. (There can be at most one such mapping.)
If this map permits null values, then a return value of
null
does not necessarily indicate that the map
contains no mapping for the key; it's also possible that the map
explicitly maps the key to null
. The containsKey
operation may be used to distinguish these two cases.
get
in interface Map<Float,Character>
key
- the key whose associated value is to be returned
null
if this map contains no mapping for the keychar get(float key)
key
- the key whose associated value is to be returned
@Deprecated Character getOrDefault(Object key, Character defaultValue)
getOrDefault(float, char)
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 keychar getOrDefault(float key, char 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 map
defaultValue
if this map contains no mapping for the keyvoid forEach(@Nonnull FloatCharConsumer 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 FloatCharPredicate 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 FloatCharCursor cursor()
Basic cursor usage idiom is:
for (FloatCharCursor cur = map.cursor(); cur.moveNext();) {
// Work with cur.key() and cur.value()
// Call cur.remove() to remove the current entry
}
@Nonnull FloatSet keySet()
java.util.Map
Set
view of the keys 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 (except through
the iterator's own remove operation), the results of
the iteration are undefined. The set supports element removal,
which removes the corresponding mapping from the map, via the
Iterator.remove, Set.remove,
removeAll, retainAll, and clear
operations. It does not support the add or addAll
operations.
keySet
in interface Map<Float,Character>
@Nonnull CharCollection values()
java.util.Map
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, and vice-versa. If the map is
modified while an iteration over the collection is in progress
(except through the iterator's own remove operation),
the results of the iteration are undefined. The collection
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Collection.remove, removeAll,
retainAll and clear operations. It does not
support the add or addAll operations.
values
in interface Map<Float,Character>
@Nonnull ObjSet<Map.Entry<Float,Character>> entrySet()
java.util.Map
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, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove operation, or through the
setValue operation on a map entry returned by the
iterator) the results of the iteration are undefined. The set
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Set.remove, removeAll, retainAll and
clear operations. It does not support the
add or addAll operations.
entrySet
in interface Map<Float,Character>
@Deprecated Character put(Float key, Character value)
put(float, char)
instead
m.containsKey(k)
would return
true.)
put
in interface Map<Float,Character>
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key
char put(float key, char 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
IllegalArgumentException
- if some property of a specified key
or value prevents it from being stored in this map@Nullable @Deprecated Character putIfAbsent(Float key, Character value)
putIfAbsent(float, char)
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 key or value is null
IllegalArgumentException
- if some property of the specified key
or value prevents it from being stored in this mapchar putIfAbsent(float key, char value)
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key
UnsupportedOperationException
- if the put
operation
is not supported by this map
IllegalArgumentException
- if some property of a specified key
or value prevents it from being stored in this mapchar compute(float key, @Nonnull FloatCharToCharFunction 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
UnsupportedOperationException
- if the put
operation
is not supported by this mapchar computeIfAbsent(float key, @Nonnull FloatToCharFunction 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
UnsupportedOperationException
- if the put
operation
is not supported by this mapchar computeIfPresent(float key, @Nonnull FloatCharToCharFunction 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
UnsupportedOperationException
- if the put
operation
is not supported by this mapchar merge(float key, char value, @Nonnull CharBinaryOperator 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
UnsupportedOperationException
- if the put
operation
is not supported by this mapchar addValue(float key, char 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 addition
UnsupportedOperationException
- if the put
operation
is not supported by this mapchar addValue(float key, char addition, char 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(float, char)
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 key
UnsupportedOperationException
- if the put
operation
is not supported by this map@Nullable @Deprecated Character replace(Float key, Character value)
replace(float, char)
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 key or value is null
IllegalArgumentException
- if some property of the specified value
prevents it from being stored in this mapchar replace(float key, char value)
key
- key with which the specified value is associatedvalue
- value to be associated with the specified key
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(Float key, Character oldValue, Character newValue)
replace(float, char, char)
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 key or value is null
IllegalArgumentException
- if some property of the specified value
prevents it from being stored in this mapboolean replace(float key, char oldValue, char 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
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 mapvoid replaceAll(@Nonnull FloatCharToCharFunction 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 Character remove(Object key)
remove(float)
instead
(key==null ? k==null : key.equals(k))
, 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 null if the map contained no mapping for the key.
If this map permits null values, then a return value of null 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 null.
The map will not contain a mapping for the specified key once the call returns.
remove
in interface Map<Float,Character>
key
- key whose mapping is to be removed from the map
char remove(float 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 map
key
, 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(float, char)
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 key or value is null
UnsupportedOperationException
- if the remove
operation
is not supported by this mapboolean remove(float key, char 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
UnsupportedOperationException
- if the remove
operation
is not supported by this mapboolean removeIf(@Nonnull FloatCharPredicate 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 |