public final class TrieMap<K,V> extends java.lang.Object implements ImmutableMap<K,V>, Higher2<DataWitness.trieMap,K,V>, java.io.Serializable
Constructor and Description |
---|
TrieMap() |
Modifier and Type | Method and Description |
---|---|
<R1,R2> TrieMap<R1,R2> |
bimap(java.util.function.BiFunction<? super K,? super V,? extends Tuple2<R1,R2>> map) |
<R1,R2> TrieMap<R1,R2> |
bimap(java.util.function.Function<? super K,? extends R1> fn1,
java.util.function.Function<? super V,? extends R2> fn2)
Transform this BiTransformable, changing two value types at once.
|
<K2,V2> TrieMap<K2,V2> |
concatMap(java.util.function.BiFunction<? super K,? super V,? extends java.lang.Iterable<Tuple2<K2,V2>>> mapper) |
boolean |
contains(Tuple2<K,V> t) |
boolean |
containsKey(K key) |
static <K,V> TrieMap<K,V> |
empty() |
boolean |
equals(java.lang.Object o) |
TrieMap<K,V> |
filter(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Keep only elements for which the supplied predicates hold
e.g.
|
TrieMap<K,V> |
filterKeys(java.util.function.Predicate<? super K> predicate) |
TrieMap<K,V> |
filterValues(java.util.function.Predicate<? super V> predicate) |
<K2,V2> TrieMap<K2,V2> |
flatMap(java.util.function.BiFunction<? super K,? super V,? extends ImmutableMap<K2,V2>> mapper) |
static <K,V> TrieMap<K,V> |
fromMap(java.util.Map<K,V> source) |
static <K,V> TrieMap<K,V> |
fromStream(java.util.stream.Stream<Tuple2<K,V>> stream) |
Option<V> |
get(K key) |
V |
getOrElse(K key,
V alt) |
V |
getOrElseGet(K key,
java.util.function.Supplier<? extends V> alt) |
int |
hashCode() |
java.util.Iterator<Tuple2<K,V>> |
iterator() |
<R> TrieMap<K,R> |
map(java.util.function.Function<? super V,? extends R> fn)
Transform this functor using the supplied transformation function
|
<R> TrieMap<R,V> |
mapKeys(java.util.function.Function<? super K,? extends R> map) |
<R> TrieMap<K,R> |
mapValues(java.util.function.Function<? super V,? extends R> map) |
<K2,V2,K3,V3> |
merge(DMap.Two<K2,V2,K3,V3> two) |
<K2,V2> DMap.Two<K,V,K2,V2> |
merge(ImmutableMap<K2,V2> one) |
static <K,V> TrieMap<K,V> |
of(K k,
V v) |
static <K,V> TrieMap<K,V> |
of(K k1,
V v1,
K k2,
V v2) |
TrieMap<K,V> |
put(K key,
V value) |
TrieMap<K,V> |
put(Tuple2<K,V> keyAndValue) |
TrieMap<K,V> |
putAll(PersistentMap<? extends K,? extends V> map) |
TrieMap<K,V> |
remove(K key) |
TrieMap<K,V> |
removeAll(K[] keys) |
int |
size() |
ReactiveSeq<Tuple2<K,V>> |
stream() |
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
allMatch, bipeek, containsValue, filterNot, forEach2, forEach2, forEach3, forEach3, forEach4, forEach4, isEmpty, javaMap, keys, mkString, notNull, onEmpty, onEmptyGet, onEmptySwitch, onEmptyTry, peek, removeAllKeys, toLazySeq, toSeq, values
anyMatch, atPercentile, bankersQueue, collect, collect, collect, collect, count, countDistinct, doubleStats, elementAt, endsWith, firstValue, foldLeft, foldLeft, foldLeft, foldLeft, foldLeft, foldLeft, foldMap, foldMap, foldMapRight, foldRight, foldRight, foldRight, groupBy, hashSet, headOption, indexOf, indexOfSlice, intStats, iterableTo, join, join, join, lastIndexOf, lastIndexOfSlice, lazySeq, longStats, maxBy, maxBy, maximum, mean, median, minBy, minBy, minimum, mode, noneMatch, nonEmptyList, occurances, populationVariance, print, print, printErr, printOut, scheduleStream, seq, single, single, singleOrElse, startsWith, stdDeviation, sumDouble, sumInt, sumLong, takeOne, toArray, toArray, toCollection, toHashMap, toHashMap, toList, toMap, toMap, toSet, treeSet, variance, vector, withPercentiles, xMatch
equalTo, mapView
public static <K,V> TrieMap<K,V> of(K k, V v)
public static <K,V> TrieMap<K,V> of(K k1, V v1, K k2, V v2)
public static <K,V> TrieMap<K,V> fromMap(java.util.Map<K,V> source)
public static <K,V> TrieMap<K,V> empty()
public TrieMap<K,V> put(K key, V value)
put
in interface PersistentMap<K,V>
put
in interface ImmutableMap<K,V>
public TrieMap<K,V> put(Tuple2<K,V> keyAndValue)
put
in interface PersistentMap<K,V>
put
in interface ImmutableMap<K,V>
public TrieMap<K,V> putAll(PersistentMap<? extends K,? extends V> map)
putAll
in interface PersistentMap<K,V>
putAll
in interface ImmutableMap<K,V>
public TrieMap<K,V> remove(K key)
remove
in interface PersistentMap<K,V>
remove
in interface ImmutableMap<K,V>
public TrieMap<K,V> removeAll(K[] keys)
removeAll
in interface ImmutableMap<K,V>
public boolean containsKey(K key)
containsKey
in interface PersistentMap<K,V>
containsKey
in interface ImmutableMap<K,V>
public boolean contains(Tuple2<K,V> t)
contains
in interface PersistentMap<K,V>
contains
in interface ImmutableMap<K,V>
public Option<V> get(K key)
get
in interface PersistentMap<K,V>
get
in interface ImmutableMap<K,V>
public V getOrElse(K key, V alt)
getOrElse
in interface PersistentMap<K,V>
getOrElse
in interface ImmutableMap<K,V>
public V getOrElseGet(K key, java.util.function.Supplier<? extends V> alt)
getOrElseGet
in interface PersistentMap<K,V>
getOrElseGet
in interface ImmutableMap<K,V>
public int size()
size
in interface PersistentMap<K,V>
size
in interface ImmutableMap<K,V>
public <K2,V2> DMap.Two<K,V,K2,V2> merge(ImmutableMap<K2,V2> one)
merge
in interface ImmutableMap<K,V>
public <K2,V2,K3,V3> DMap.Three<K,V,K2,V2,K3,V3> merge(DMap.Two<K2,V2,K3,V3> two)
merge
in interface ImmutableMap<K,V>
public ReactiveSeq<Tuple2<K,V>> stream()
public <R> TrieMap<K,R> mapValues(java.util.function.Function<? super V,? extends R> map)
mapValues
in interface ImmutableMap<K,V>
public <R> TrieMap<R,V> mapKeys(java.util.function.Function<? super K,? extends R> map)
mapKeys
in interface ImmutableMap<K,V>
public <R1,R2> TrieMap<R1,R2> bimap(java.util.function.BiFunction<? super K,? super V,? extends Tuple2<R1,R2>> map)
bimap
in interface ImmutableMap<K,V>
public <K2,V2> TrieMap<K2,V2> flatMap(java.util.function.BiFunction<? super K,? super V,? extends ImmutableMap<K2,V2>> mapper)
flatMap
in interface ImmutableMap<K,V>
public <K2,V2> TrieMap<K2,V2> concatMap(java.util.function.BiFunction<? super K,? super V,? extends java.lang.Iterable<Tuple2<K2,V2>>> mapper)
concatMap
in interface ImmutableMap<K,V>
public TrieMap<K,V> filter(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Filters
of(1,2,3).filter(i->i>2);
//[3]
public TrieMap<K,V> filterKeys(java.util.function.Predicate<? super K> predicate)
filterKeys
in interface ImmutableMap<K,V>
public TrieMap<K,V> filterValues(java.util.function.Predicate<? super V> predicate)
filterValues
in interface ImmutableMap<K,V>
public <R> TrieMap<K,R> map(java.util.function.Function<? super V,? extends R> fn)
Transformable
of(1,2,3).map(i->i*2)
//[2,4,6]
map
in interface Transformable<V>
map
in interface ImmutableMap<K,V>
fn
- Transformation functionpublic <R1,R2> TrieMap<R1,R2> bimap(java.util.function.Function<? super K,? extends R1> fn1, java.util.function.Function<? super V,? extends R2> fn2)
BiTransformable
MapX<String,Integer> map = MapXs.of("hello",2);
MapX<String,Integer> transformedMap = map.bimap(s->s+" world",i->i*4);
//["hello world",8]
bimap
in interface BiTransformable<K,V>
bimap
in interface ImmutableMap<K,V>
fn1
- transformation function for the first typefn2
- transformation function for the second typepublic java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object