public class SortedMap<K,V> extends Object implements ISortedMap<K,V>
| Modifier and Type | Field and Description |
|---|---|
io.lacuna.bifurcan.nodes.SortedMapNodes.Node<K,V> |
root |
| Constructor and Description |
|---|
SortedMap() |
SortedMap(Comparator<K> comparator) |
| Modifier and Type | Method and Description |
|---|---|
IEntry<K,V> |
ceil(K key) |
SortedMap<K,V> |
clone() |
Comparator<K> |
comparator() |
boolean |
contains(K key) |
boolean |
equals(Object obj) |
IEntry<K,V> |
floor(K key) |
SortedMap<K,V> |
forked()
This returns a data structure which is forked, which is equivalent to Clojure's persistent
data structures, also sometimes called functional or immutable.
|
static <K,V> SortedMap<K,V> |
from(Map<K,V> m) |
V |
get(K key,
V defaultValue) |
int |
hashCode() |
OptionalLong |
indexOf(K key) |
boolean |
isLinear() |
Iterator<IEntry<K,V>> |
iterator() |
BiPredicate<K,K> |
keyEquality() |
ToLongFunction<K> |
keyHash() |
SortedMap<K,V> |
linear()
This returns a data structure which is linear, or temporarily mutable.
|
<U> SortedMap<K,U> |
mapValues(BiFunction<K,V,U> f) |
IEntry<K,V> |
nth(long idx) |
SortedMap<K,V> |
put(K key,
V value) |
SortedMap<K,V> |
put(K key,
V value,
BinaryOperator<V> merge) |
SortedMap<K,V> |
remove(K key) |
long |
size() |
SortedMap<K,V> |
slice(K min,
K max) |
List<SortedMap<K,V>> |
split(int parts)
Splits the collection into roughly even pieces, for parallel processing.
|
String |
toString() |
SortedMap<K,V> |
update(K key,
UnaryOperator<V> update) |
finalize, getClass, notify, notifyAll, wait, wait, waitdifference, difference, first, intersection, last, merge, unionapply, containsAll, containsAll, containsAny, containsAny, entries, equals, get, getOrCreate, hashSortedEntries, intersection, keys, save, spliterator, stream, toMap, valuesnth, savepublic SortedMap()
public SortedMap(Comparator<K> comparator)
public Comparator<K> comparator()
comparator in interface ISortedMap<K,V>public IEntry<K,V> floor(K key)
floor in interface ISortedMap<K,V>key, or just below it. If key is less than the
minimum value in the map, returns null.public IEntry<K,V> ceil(K key)
ceil in interface ISortedMap<K,V>key, or just above it. If key is greater than the
maximum value in the map, returns null.public SortedMap<K,V> slice(K min, K max)
slice in interface ISortedMap<K,V>min - the inclusive minimum key valuemax - the inclusive maximum key valuepublic List<SortedMap<K,V>> split(int parts)
ICollectionparts subsets.public SortedMap<K,V> put(K key, V value, BinaryOperator<V> merge)
put in interface IMap<K,V>put in interface ISortedMap<K,V>merge - a function which will be invoked if there is a pre-existing value under key, with the current
value as the first argument and new value as the second, to determine the combined resultvalue under keypublic boolean contains(K key)
public OptionalLong indexOf(K key)
public <U> SortedMap<K,U> mapValues(BiFunction<K,V,U> f)
public long size()
public boolean isLinear()
public SortedMap<K,V> forked()
ICollectionIf only a single function or scope uses the data structure, it can be left as a linear data structure, which can have significant performance benefits.
If the data structure is already forked, it will simply return itself.
public SortedMap<K,V> linear()
ICollection
If ICollection.forked() is called on a linear collection, all references to that linear collection should be discarded.
If the data structure is already linear, it will simply return itself.
public ToLongFunction<K> keyHash()
public BiPredicate<K,K> keyEquality()
keyEquality in interface IMap<K,V>