Class IntTreePMap<V>
- Type Parameters:
V-
- All Implemented Interfaces:
Serializable, Map<Integer,V>, PMap<Integer, V>
public final class IntTreePMap<V>
extends AbstractUnmodifiableMap<Integer,V>
implements PMap<Integer,V>, Serializable
An efficient persistent map from integer keys to values. Null values are supported.
Iteration occurs in the integer order of the keys.
This implementation is thread-safe (assuming Java's AbstractMap and AbstractSet are thread-safe), although its iterators may not be.
The balanced tree is based on the Glasgow Haskell Compiler's Data.Map implementation, which in turn is based on "size balanced binary trees" as described by:
Stephen Adams, "Efficient sets: a balancing act", Journal of Functional Programming 3(4):553-562, October 1993, http://www.swiss.ai.mit.edu/~adams/BB/.
J. Nievergelt and E.M. Reingold, "Binary search trees of bounded balance", SIAM journal of computing 2(1), March 1973.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsKey(Object key) static <V> IntTreePMap<V> empty()entrySet()static <V> IntTreePMap<V> minusAll(Collection<?> keys) minusRange(int start, int end) / IMPLEMENTED METHODS OF PMap////static <V> IntTreePMap<V> intsize()/ OVERRIDDEN METHODS FROM AbstractMap ////(package private) IntTreePMap<V> withKeysChangedAbove(int key, int delta) (package private) IntTreePMap<V> withKeysChangedBelow(int key, int delta) private IntTreePMap<V> Methods inherited from class AbstractUnmodifiableMap
clear, compute, computeIfAbsent, computeIfPresent, merge, put, putAll, putIfAbsent, remove, replace, replaceAllMethods inherited from class AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, toString, valuesMethods inherited from interface Map
compute, computeIfAbsent, computeIfPresent, containsValue, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, values
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
EMPTY
/ STATIC FACTORY METHODS //// -
root
-
entrySet
-
-
Constructor Details
-
IntTreePMap
-
-
Method Details
-
empty
- Type Parameters:
V-- Returns:
- an empty map
-
singleton
- Type Parameters:
V-- Parameters:
key-value-- Returns:
- empty().plus(key, value)
-
from
- Type Parameters:
V-- Parameters:
map-- Returns:
- empty().plusAll(map)
-
withRoot
-
minusRange
- Parameters:
start-end-- Returns:
- this map but with all keys start≤k<end removed
-
withKeysChangedAbove
-
withKeysChangedBelow
-
entrySet
-
size
-
containsKey
- Specified by:
containsKeyin interfaceMap<Integer,V> - Overrides:
containsKeyin classAbstractMap<Integer,V>
-
get
-
plus
-
minus
-
plusAll
-
minusAll
-