Package com.jcabi.immutable
Class ArrayMap<K,V>
- java.lang.Object
-
- com.jcabi.immutable.ArrayMap<K,V>
-
- Type Parameters:
K- Map key typeV- Value key type
- All Implemented Interfaces:
ConcurrentMap<K,V>,Map<K,V>
@Immutable @Loggable(1) public final class ArrayMap<K,V> extends Object implements ConcurrentMap<K,V>
Map on top of array.This class is truly immutable. This means that it never changes its encapsulated values and is annotated with
@Immutableannotation.Limitation: Encapsulated objects with exposed mutators can mutate their state.
- Since:
- 0.1
- Suppressed Checkstyle violations:
- MissingDeprecatedCheck (400 lines)
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclear()Deprecated.booleancontainsKey(Object key)booleancontainsValue(Object value)Set<Map.Entry<K,V>>entrySet()booleanequals(Object object)Vget(Object key)inthashCode()booleanisEmpty()Set<K>keySet()Vput(K key, V value)Deprecated.voidputAll(Map<? extends K,? extends V> map)Deprecated.VputIfAbsent(K key, V value)Deprecated.Vremove(Object key)Deprecated.booleanremove(Object key, Object value)Deprecated.Vreplace(K key, V value)Deprecated.booleanreplace(K key, V old, V value)Deprecated.intsize()StringtoString()Collection<V>values()ArrayMap<K,V>with(Map<K,V> ents)Make a new one with these extra entries.ArrayMap<K,V>with(K key, V value)Make a new one with an extra entry.ArrayMap<K,V>without(Collection<K> keys)Make a new one without these keys.ArrayMap<K,V>without(K key)Make a new one without this key.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
-
-
-
Method Detail
-
with
public ArrayMap<K,V> with(K key, V value)
Make a new one with an extra entry.- Parameters:
key- The keyvalue- The value- Returns:
- New map
-
with
public ArrayMap<K,V> with(Map<K,V> ents)
Make a new one with these extra entries.- Parameters:
ents- Entries- Returns:
- New map
- Since:
- 0.11
-
without
public ArrayMap<K,V> without(K key)
Make a new one without this key.- Parameters:
key- The key- Returns:
- New map
-
without
public ArrayMap<K,V> without(Collection<K> keys)
Make a new one without these keys.- Parameters:
keys- The keys to remove- Returns:
- New map
- Since:
- 0.11
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object object)
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<K,V>
-
remove
@Deprecated public V remove(Object key)
Deprecated.
-
putAll
@Deprecated public void putAll(Map<? extends K,? extends V> map)
Deprecated.
-
clear
@Deprecated public void clear()
Deprecated.
-
putIfAbsent
@Deprecated public V putIfAbsent(K key, V value)
Deprecated.- Specified by:
putIfAbsentin interfaceConcurrentMap<K,V>- Specified by:
putIfAbsentin interfaceMap<K,V>
-
remove
@Deprecated public boolean remove(Object key, Object value)
Deprecated.
-
replace
@Deprecated public boolean replace(K key, V old, V value)
Deprecated.
-
replace
@Deprecated public V replace(K key, V value)
Deprecated.
-
-