V
- the type of valuespublic class CharSequenceMap<V>
extends java.lang.Object
implements java.util.Map<java.lang.CharSequence,V>, java.io.Serializable
This implementation wraps provided keys into CharSequenceWrapper
for consistent
hashing and equals behavior. This ensures that objects of different types that represent the same
sequence of characters are treated as equal keys in the map.
Note: This map is not designed for concurrent modification by multiple threads. However, it supports safe concurrent reads, assuming there are no concurrent writes.
Note: This map does not support null keys.
Modifier and Type | Method and Description |
---|---|
void |
clear() |
V |
computeIfAbsent(java.lang.CharSequence key,
java.util.function.Supplier<V> valueSupplier) |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
static <T> CharSequenceMap<T> |
create() |
java.util.Set<java.util.Map.Entry<java.lang.CharSequence,V>> |
entrySet() |
boolean |
equals(java.lang.Object other) |
V |
get(java.lang.Object key) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Set<java.lang.CharSequence> |
keySet() |
V |
put(java.lang.CharSequence key,
V value) |
void |
putAll(java.util.Map<? extends java.lang.CharSequence,? extends V> otherMap) |
V |
remove(java.lang.Object key) |
int |
size() |
java.lang.String |
toString() |
java.util.Collection<V> |
values() |
public static <T> CharSequenceMap<T> create()
public int size()
size
in interface java.util.Map<java.lang.CharSequence,V>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.CharSequence,V>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.CharSequence,V>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.CharSequence,V>
public V get(java.lang.Object key)
get
in interface java.util.Map<java.lang.CharSequence,V>
public V put(java.lang.CharSequence key, V value)
put
in interface java.util.Map<java.lang.CharSequence,V>
public V remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.CharSequence,V>
public void putAll(java.util.Map<? extends java.lang.CharSequence,? extends V> otherMap)
putAll
in interface java.util.Map<java.lang.CharSequence,V>
public void clear()
clear
in interface java.util.Map<java.lang.CharSequence,V>
public java.util.Set<java.lang.CharSequence> keySet()
keySet
in interface java.util.Map<java.lang.CharSequence,V>
public java.util.Collection<V> values()
values
in interface java.util.Map<java.lang.CharSequence,V>
public java.util.Set<java.util.Map.Entry<java.lang.CharSequence,V>> entrySet()
entrySet
in interface java.util.Map<java.lang.CharSequence,V>
public V computeIfAbsent(java.lang.CharSequence key, java.util.function.Supplier<V> valueSupplier)
public boolean equals(java.lang.Object other)
equals
in interface java.util.Map<java.lang.CharSequence,V>
equals
in class java.lang.Object
public int hashCode()
hashCode
in interface java.util.Map<java.lang.CharSequence,V>
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object