Class AbstractChar2ObjectMap<V>
- java.lang.Object
-
- org.codelibs.jhighlight.fastutil.chars.AbstractChar2ObjectFunction<V>
-
- org.codelibs.jhighlight.fastutil.chars.AbstractChar2ObjectMap<V>
-
- All Implemented Interfaces:
Serializable
,Map<Character,V>
,Char2ObjectFunction<V>
,Char2ObjectMap<V>
,Function<Character,V>
- Direct Known Subclasses:
Char2ObjectOpenHashMap
public abstract class AbstractChar2ObjectMap<V> extends AbstractChar2ObjectFunction<V> implements Char2ObjectMap<V>, Serializable
An abstract class providing basic methods for maps implementing a type-specific interface.Optional operations just throw an
UnsupportedOperationException
. Generic versions of accessors delegate to the corresponding type-specific counterparts following the interface rules (they take care of returningnull
on a missing key).As a further help, this class provides a
BasicEntry
inner class that implements a type-specific version ofMap.Entry
; it is particularly useful for those classes that do not implement their own entries (e.g., most immutable maps).- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractChar2ObjectMap.BasicEntry<V>
This class provides a basic but complete type-specific entry class for all those maps implementations that do not have entries on their own (e.g., most immutable maps).-
Nested classes/interfaces inherited from interface org.codelibs.jhighlight.fastutil.chars.Char2ObjectMap
Char2ObjectMap.Entry<V>, Char2ObjectMap.FastEntrySet<V>
-
-
Field Summary
-
Fields inherited from class org.codelibs.jhighlight.fastutil.chars.AbstractChar2ObjectFunction
defRetValue
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractChar2ObjectMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsKey(char k)
Checks whether the given value is contained inkeySet()
.boolean
containsValue(Object v)
Checks whether the given value is contained invalues()
.ObjectSet<Map.Entry<Character,V>>
entrySet()
Returns a set view of the mappings contained in this map.boolean
equals(Object o)
int
hashCode()
Returns a hash code for this map.boolean
isEmpty()
CharSet
keySet()
Returns a type-specific-set view of the keys of this map.void
putAll(Map<? extends Character,? extends V> m)
Puts all pairs in the given map.String
toString()
ObjectCollection<V>
values()
Returns a type-specific-set view of the values of this map.-
Methods inherited from class org.codelibs.jhighlight.fastutil.chars.AbstractChar2ObjectFunction
clear, containsKey, defaultReturnValue, defaultReturnValue, get, put, put, remove, remove
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.codelibs.jhighlight.fastutil.chars.Char2ObjectFunction
defaultReturnValue, defaultReturnValue, get, put, remove
-
Methods inherited from interface org.codelibs.jhighlight.fastutil.chars.Char2ObjectMap
char2ObjectEntrySet
-
Methods inherited from interface org.codelibs.jhighlight.fastutil.Function
clear, containsKey, get, put, remove, size
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, forEach, get, getOrDefault, merge, put, putIfAbsent, remove, remove, replace, replace, replaceAll, size
-
-
-
-
Method Detail
-
containsValue
public boolean containsValue(Object v)
Checks whether the given value is contained invalues()
.- Specified by:
containsValue
in interfaceMap<Character,V>
-
containsKey
public boolean containsKey(char k)
Checks whether the given value is contained inkeySet()
.- Specified by:
containsKey
in interfaceChar2ObjectFunction<V>
- See Also:
Function.containsKey(Object)
-
putAll
public void putAll(Map<? extends Character,? extends V> m)
Puts all pairs in the given map. If the map implements the interface of this map, it uses the faster iterators.
-
keySet
public CharSet keySet()
Returns a type-specific-set view of the keys of this map.The view is backed by the set returned by
entrySet()
. Note that no attempt is made at caching the result of this method, as this would require adding some attributes that lightweight implementations would not need. Subclasses may easily override this policy by calling this method and caching the result, but implementors are encouraged to write more efficient ad-hoc implementations.- Specified by:
keySet
in interfaceChar2ObjectMap<V>
- Specified by:
keySet
in interfaceMap<Character,V>
- Returns:
- a set view of the keys of this map; it may be safely cast to a type-specific interface.
- See Also:
Map.keySet()
-
values
public ObjectCollection<V> values()
Returns a type-specific-set view of the values of this map.The view is backed by the set returned by
entrySet()
. Note that no attempt is made at caching the result of this method, as this would require adding some attributes that lightweight implementations would not need. Subclasses may easily override this policy by calling this method and caching the result, but implementors are encouraged to write more efficient ad-hoc implementations.- Specified by:
values
in interfaceChar2ObjectMap<V>
- Specified by:
values
in interfaceMap<Character,V>
- Returns:
- a set view of the values of this map; it may be safely cast to a type-specific interface.
- See Also:
Map.values()
-
entrySet
public ObjectSet<Map.Entry<Character,V>> entrySet()
Description copied from interface:Char2ObjectMap
Returns a set view of the mappings contained in this map.Note that this specification strengthens the one given in
Map.entrySet()
.- Specified by:
entrySet
in interfaceChar2ObjectMap<V>
- Specified by:
entrySet
in interfaceMap<Character,V>
- Returns:
- a set view of the mappings contained in this map.
- See Also:
Map.entrySet()
-
hashCode
public int hashCode()
Returns a hash code for this map. The hash code of a map is computed by summing the hash codes of its entries.
-
equals
public boolean equals(Object o)
-
-