Package org.olap4j.impl
Class ArrayMap<K,V>
java.lang.Object
org.olap4j.impl.ArrayMap<K,V>
- All Implemented Interfaces:
Map<K,
V>
- Direct Known Subclasses:
UnmodifiableArrayMap
Implementation of
Map
which uses an array and is therefore
not very fast but very space-efficient.
This implementation uses very little space but is inefficient. The
operations put(K, V)
, remove(java.lang.Object)
, get(java.lang.Object)
all take time
proportional to the number of keys.
- Since:
- Dec 9, 2007
- Author:
- jhyde
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
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
-
ArrayMap
public ArrayMap()Creates an empty ArrayMap. -
ArrayMap
Creates an ArrayMap whose contents the same as the given map.This method is a more efficient way to build a large array than repeatly calling
put(K, V)
or even callingputAll(java.util.Map<? extends K, ? extends V>)
.- Parameters:
map
- Map
-
-
Method Details
-
of
Returns an 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
-
equals
-
hashCode
public int hashCode() -
size
public int size() -
isEmpty
public boolean isEmpty() -
containsKey
- Specified by:
containsKey
in interfaceMap<K,
V>
-
containsValue
- Specified by:
containsValue
in interfaceMap<K,
V>
-
get
-
put
-
remove
-
putAll
-
clear
public void clear() -
keySet
-
values
-
entrySet
-
toString
-