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
@Immutable
annotation.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 void
clear()
Deprecated.boolean
containsKey(Object key)
boolean
containsValue(Object value)
Set<Map.Entry<K,V>>
entrySet()
boolean
equals(Object object)
V
get(Object key)
int
hashCode()
boolean
isEmpty()
Set<K>
keySet()
V
put(K key, V value)
Deprecated.void
putAll(Map<? extends K,? extends V> map)
Deprecated.V
putIfAbsent(K key, V value)
Deprecated.V
remove(Object key)
Deprecated.boolean
remove(Object key, Object value)
Deprecated.V
replace(K key, V value)
Deprecated.boolean
replace(K key, V old, V value)
Deprecated.int
size()
String
toString()
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:
containsKey
in interfaceMap<K,V>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValue
in 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:
putIfAbsent
in interfaceConcurrentMap<K,V>
- Specified by:
putIfAbsent
in 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.
-
-