Modifier and Type | Method and Description |
---|---|
boolean |
contains(K k)
Determines if the given key value exists in this tree map.
|
TreeMap<K,V> |
delete(K k)
Deletes the entry in the tree map that corresponds to the given key.
|
static <K,V> TreeMap<K,V> |
empty(Ord<K> keyOrd)
Constructs an empty tree map.
|
boolean |
equals(java.lang.Object other) |
static <K,V> TreeMap<K,V> |
fromMutableMap(Ord<K> ord,
java.util.Map<K,V> m)
An immutable projection of the given mutable map.
|
F<K,Option<V>> |
get()
Returns a first-class version of the get method for this TreeMap.
|
Option<V> |
get(K k)
Returns a potential value that the given key maps to.
|
int |
hashCode() |
boolean |
isEmpty()
Determines if this tree map has any entries.
|
java.util.Iterator<P2<K,V>> |
iterator()
Returns an iterator for this map's key-value pairs.
|
List<K> |
keys()
Returns all keys in this tree map.
|
<W> TreeMap<K,W> |
map(F<V,W> f)
Maps the given function across the values of this TreeMap.
|
TreeMap<K,V> |
set(K k,
V v)
Inserts the given key and value association into the tree map.
|
int |
size()
Returns the number of entries in this tree map.
|
P3<Set<V>,Option<V>,Set<V>> |
split(Ord<V> ord,
K k)
Splits this TreeMap at the given key.
|
P3<TreeMap<K,V>,Option<V>,TreeMap<K,V>> |
splitLookup(K k)
Splits this TreeMap at the given key.
|
java.util.Map<K,V> |
toMutableMap()
A mutable map projection of this tree map.
|
Stream<P2<K,V>> |
toStream() |
java.lang.String |
toString() |
static <K,V> TreeMap<K,V> |
treeMap(Ord<K> keyOrd,
List<P2<K,V>> list)
Constructs a tree map from the given elements.
|
static <K,V> TreeMap<K,V> |
treeMap(Ord<K> keyOrd,
P2<K,V>... p2s)
Constructs a tree map from the given elements.
|
TreeMap<K,V> |
union(java.lang.Iterable<P2<K,V>> t2)
The expression
t1.union(t2) takes the left-biased union of t1
and t2 . |
TreeMap<K,V> |
union(TreeMap<K,V> t2)
The expression
t1.union(t2) takes the left-biased union of t1
and t2 . |
P2<java.lang.Boolean,TreeMap<K,V>> |
update(K k,
F<V,V> f)
Modifies the value for the given key, if present, by applying the given function to it.
|
TreeMap<K,V> |
update(K k,
F<V,V> f,
V v)
Modifies the value for the given key, if present, by applying the given function to it, or
inserts the given value if the key is not present.
|
List<V> |
values()
Returns all values in this tree map.
|
public static <K,V> TreeMap<K,V> empty(Ord<K> keyOrd)
keyOrd
- An order for the keys of the tree map.public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static <K,V> TreeMap<K,V> treeMap(Ord<K> keyOrd, P2<K,V>... p2s)
keyOrd
- An order for the keys of the tree map.p2s
- The elements to construct the tree map with.public static <K,V> TreeMap<K,V> treeMap(Ord<K> keyOrd, List<P2<K,V>> list)
keyOrd
- An order for the keys of the tree map.list
- The elements to construct the tree map with.public Option<V> get(K k)
k
- The key to look up in the tree map.public TreeMap<K,V> set(K k, V v)
k
- The key to insert.v
- The value to insert.public TreeMap<K,V> delete(K k)
k
- The key to delete from this tree map.public int size()
public boolean isEmpty()
true
if this tree map has no entries, false
otherwise.public List<V> values()
public boolean contains(K k)
k
- The key value to look for in this tree map.true
if this tree map contains the given key, false
otherwise.public java.util.Iterator<P2<K,V>> iterator()
for
-each loop.public java.util.Map<K,V> toMutableMap()
public static <K,V> TreeMap<K,V> fromMutableMap(Ord<K> ord, java.util.Map<K,V> m)
ord
- An order for the map's keys.m
- A mutable map to project to an immutable one.public F<K,Option<V>> get()
public P2<java.lang.Boolean,TreeMap<K,V>> update(K k, F<V,V> f)
k
- The key for the value to modify.f
- A function with which to modify the value.public TreeMap<K,V> update(K k, F<V,V> f, V v)
k
- The key for the value to modify.f
- A function with which to modify the value.v
- A value to associate with the given key if the key is not already present.public P3<Set<V>,Option<V>,Set<V>> split(Ord<V> ord, K k)
k
- A key at which to split this map.public P3<TreeMap<K,V>,Option<V>,TreeMap<K,V>> splitLookup(K k)
k
- A key at which to split this map.public <W> TreeMap<K,W> map(F<V,W> f)
f
- A function to apply to the values of this TreeMap.public TreeMap<K,V> union(TreeMap<K,V> t2)
t1.union(t2)
takes the left-biased union of t1
and t2
. It prefers t1
when duplicate keys are encountered.t2
- The other tree we wish to combine with this one