Class TreeCollisionMap<K,V>
java.lang.Object
org.javimmutable.collections.tree.TreeCollisionMap<K,V>
- All Implemented Interfaces:
CollisionMap<K,
V>
CollisionMap implementation that stores values in Node objects (balanced trees).
Usable with keys that implement Comparable. Will fail with any other
type of key.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.javimmutable.collections.common.CollisionMap
CollisionMap.Node
-
Method Summary
Modifier and TypeMethodDescriptiondelete
(CollisionMap.Node node, K key) empty()
findEntry
(CollisionMap.Node node, K key) findValue
(CollisionMap.Node node, K key) first
(CollisionMap.Node node) void
forEach
(CollisionMap.Node node, Proc2<K, V> proc) <E extends Exception>
voidforEachThrows
(CollisionMap.Node node, Proc2Throws<K, V, E> proc) getValueOr
(CollisionMap.Node node, K key, V defaultValue) static <K,
V> TreeCollisionMap <K, V> instance()
iterateOverRange
(CollisionMap.Node node, GenericIterator.State<IMapEntry<K, V>> parent, int offset, int limit) <R> R
reduce
(CollisionMap.Node node, R sum, Sum2<K, V, R> proc) <R,
E extends Exception>
RreduceThrows
(CollisionMap.Node node, R sum, Sum2Throws<K, V, R, E> proc) int
size
(CollisionMap.Node node) update
(CollisionMap.Node node, K key, V value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.javimmutable.collections.common.CollisionMap
genericIterable, iterable, iterator
-
Method Details
-
instance
-
empty
- Specified by:
empty
in interfaceCollisionMap<K,
V>
-
single
- Specified by:
single
in interfaceCollisionMap<K,
V>
-
dual
@Nonnull public CollisionMap.Node dual(@Nonnull K key1, @Nullable V value1, @Nonnull K key2, @Nullable V value2) - Specified by:
dual
in interfaceCollisionMap<K,
V>
-
size
- Specified by:
size
in interfaceCollisionMap<K,
V>
-
update
@Nonnull public CollisionMap.Node update(@Nonnull CollisionMap.Node node, @Nonnull K key, @Nullable V value) - Specified by:
update
in interfaceCollisionMap<K,
V>
-
update
@Nonnull public CollisionMap.Node update(@Nonnull CollisionMap.Node node, @Nonnull K key, @Nonnull Func1<Maybe<V>, V> generator) - Specified by:
update
in interfaceCollisionMap<K,
V>
-
delete
- Specified by:
delete
in interfaceCollisionMap<K,
V>
-
getValueOr
- Specified by:
getValueOr
in interfaceCollisionMap<K,
V>
-
findValue
- Specified by:
findValue
in interfaceCollisionMap<K,
V>
-
findEntry
- Specified by:
findEntry
in interfaceCollisionMap<K,
V>
-
first
- Specified by:
first
in interfaceCollisionMap<K,
V>
-
iterateOverRange
@Nullable public GenericIterator.State<IMapEntry<K,V>> iterateOverRange(@Nonnull CollisionMap.Node node, @Nullable GenericIterator.State<IMapEntry<K, V>> parent, int offset, int limit) - Specified by:
iterateOverRange
in interfaceCollisionMap<K,
V>
-
forEach
- Specified by:
forEach
in interfaceCollisionMap<K,
V>
-
forEachThrows
public <E extends Exception> void forEachThrows(@Nonnull CollisionMap.Node node, @Nonnull Proc2Throws<K, V, throws EE> proc) - Specified by:
forEachThrows
in interfaceCollisionMap<K,
V> - Throws:
E
-
reduce
- Specified by:
reduce
in interfaceCollisionMap<K,
V>
-
reduceThrows
public <R,E extends Exception> R reduceThrows(@Nonnull CollisionMap.Node node, R sum, @Nonnull Sum2Throws<K, V, throws ER, E> proc) - Specified by:
reduceThrows
in interfaceCollisionMap<K,
V> - Throws:
E
-