Package org.olap4j.impl
Class UnmodifiableArrayMap<K,V>
java.lang.Object
org.olap4j.impl.ArrayMap<K,V>
org.olap4j.impl.UnmodifiableArrayMap<K,V>
- All Implemented Interfaces:
Map<K,
V>
Unmodifiable map backed by an array.
Has the same benefits and limitations as ArrayMap
. It is extremely
space-efficient but has poor performance for insert and lookup.
This structure is ideal if you are creating many maps with few elements.
The of(java.util.Map)
method will use
Collections.emptyMap()
and
Collections.singletonMap(Object, Object)
if possible, and
these are even more space-efficient for maps of size 0 and 1.
- Since:
- Jan 16, 2010
- Author:
- jhyde
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.olap4j.impl.ArrayMap
containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, size, toString, values
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
UnmodifiableArrayMap
Creates an UnmodifiableArrayMap.- Parameters:
map
- Contents of map, copied on creation
-
-
Method Details
-
put
-
remove
-
putAll
-
clear
public void clear() -
of
Returns an unmodifiable array map with given contents.- Type Parameters:
K
- Key typeV
- Value type- Parameters:
key
- First keyvalue
- First valuekeyValues
- Second and sequent key/value pairs- Returns:
- Map with given contents
-
of
Creates an unmodifable map as a shallow copy of a map.Future changes to the map will not be reflected in the contents of the map.
- Type Parameters:
K
- Key typeV
- Value type- Returns:
- Unmodifiable map with same contents that the map had at call time
-