public final class LinkedMap<K,V> extends java.lang.Object implements ImmutableMap<K,V>, Higher2<DataWitness.linkedHashMap,K,V>
Constructor and Description |
---|
LinkedMap() |
Modifier and Type | Method and Description |
---|---|
<R1,R2> ImmutableMap<R1,R2> |
bimap(java.util.function.BiFunction<? super K,? super V,? extends Tuple2<R1,R2>> map) |
<R1,R2> ImmutableMap<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.
|
LinkedMap<K,V> |
bipeek(java.util.function.Consumer<? super K> c1,
java.util.function.Consumer<? super V> c2)
Peek at two data types simulatanously (typically to perform a side-effect with each data point)
|
<K2,V2> ImmutableMap<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> LinkedMap<K,V> |
empty() |
boolean |
equals(java.lang.Object o) |
ImmutableMap<K,V> |
filter(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Keep only elements for which the supplied predicates hold
e.g.
|
ImmutableMap<K,V> |
filterKeys(java.util.function.Predicate<? super K> predicate) |
LinkedMap<K,V> |
filterNot(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Remove any elements for which the predicate holds (inverse operation to filter)
e.g.
|
ImmutableMap<K,V> |
filterValues(java.util.function.Predicate<? super V> predicate) |
<K2,V2> ImmutableMap<K2,V2> |
flatMap(java.util.function.BiFunction<? super K,? super V,? extends ImmutableMap<K2,V2>> mapper) |
<K1,K2,R1,R> |
forEach2(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1,
java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends Tuple2<K2,R>> yieldingFunction) |
<K1,K2,R1,R> |
forEach2(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1,
java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,java.lang.Boolean> filterFunction,
java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends Tuple2<K2,R>> yieldingFunction) |
<K1,K2,K3,R1,R2,R> |
forEach3(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1,
java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends java.lang.Iterable<Tuple2<K2,R2>>> iterable2,
Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? extends Tuple2<K3,R>> yieldingFunction) |
<K1,K2,K3,R1,R2,R> |
forEach3(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1,
java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends java.lang.Iterable<Tuple2<K2,R2>>> iterable2,
Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,java.lang.Boolean> filterFunction,
Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? extends Tuple2<K3,R>> yieldingFunction) |
<K1,K2,K3,K4,R1,R2,R3,R> |
forEach4(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1,
java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends java.lang.Iterable<Tuple2<K2,R2>>> iterable2,
Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? extends java.lang.Iterable<Tuple2<K3,R3>>> iterable3,
Function4<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? super Tuple2<K3,R3>,? extends Tuple2<K4,R>> yieldingFunction) |
<K1,K2,K3,K4,R1,R2,R3,R> |
forEach4(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1,
java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends java.lang.Iterable<Tuple2<K2,R2>>> iterable2,
Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? extends java.lang.Iterable<Tuple2<K3,R3>>> iterable3,
Function4<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? super Tuple2<K3,R3>,java.lang.Boolean> filterFunction,
Function4<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? super Tuple2<K3,R3>,? extends Tuple2<K4,R>> yieldingFunction) |
static <K,V> LinkedMap<K,V> |
fromMap(java.util.Map<K,V> source) |
static <K,V> LinkedMap<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> ImmutableMap<K,R> |
map(java.util.function.Function<? super V,? extends R> fn)
Transform this functor using the supplied transformation function
|
<R> ImmutableMap<R,V> |
mapKeys(java.util.function.Function<? super K,? extends R> map) |
<R> ImmutableMap<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) |
LinkedMap<K,V> |
notNull()
Filter elements retaining only values which are not null
|
static <K,V> LinkedMap<K,V> |
of(K k,
V v) |
static <K,V> LinkedMap<K,V> |
of(K k1,
V v1,
K k2,
V v2) |
LinkedMap<K,V> |
onEmpty(Tuple2<K,V> value)
If this Container instance is zero, create a new instance containing the provided value
|
LinkedMap<K,V> |
onEmptyGet(java.util.function.Supplier<? extends Tuple2<K,V>> supplier)
If this Container instance is zero, create a new instance containing the value returned from the provided Supplier
|
LinkedMap<K,V> |
onEmptySwitch(java.util.function.Supplier<? extends ImmutableMap<K,V>> supplier)
Switch to container created by provided Supplier, if current Container zero
|
LinkedMap<K,V> |
peek(java.util.function.Consumer<? super V> c)
Peek at the current value of this Transformable, without transforming it
|
LinkedMap<K,V> |
put(K key,
V value) |
ImmutableMap<K,V> |
put(Tuple2<K,V> keyAndValue) |
ImmutableMap<K,V> |
putAll(PersistentMap<? extends K,? extends V> map) |
LinkedMap<K,V> |
remove(K key) |
LinkedMap<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, containsValue, isEmpty, javaMap, keys, mkString, onEmptyTry, 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> LinkedMap<K,V> empty()
public static <K,V> LinkedMap<K,V> of(K k, V v)
public static <K,V> LinkedMap<K,V> of(K k1, V v1, K k2, V v2)
public static <K,V> LinkedMap<K,V> fromMap(java.util.Map<K,V> source)
public static <K,V> LinkedMap<K,V> fromStream(java.util.stream.Stream<Tuple2<K,V>> stream)
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> ImmutableMap<K,R> mapValues(java.util.function.Function<? super V,? extends R> map)
mapValues
in interface ImmutableMap<K,V>
public <R> ImmutableMap<R,V> mapKeys(java.util.function.Function<? super K,? extends R> map)
mapKeys
in interface ImmutableMap<K,V>
public <R1,R2> ImmutableMap<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> ImmutableMap<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> ImmutableMap<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 ImmutableMap<K,V> filter(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Filters
of(1,2,3).filter(i->i>2);
//[3]
public ImmutableMap<K,V> filterKeys(java.util.function.Predicate<? super K> predicate)
filterKeys
in interface ImmutableMap<K,V>
public ImmutableMap<K,V> filterValues(java.util.function.Predicate<? super V> predicate)
filterValues
in interface ImmutableMap<K,V>
public <R> ImmutableMap<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> ImmutableMap<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 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 LinkedMap<K,V> put(K key, V value)
put
in interface PersistentMap<K,V>
put
in interface ImmutableMap<K,V>
public ImmutableMap<K,V> put(Tuple2<K,V> keyAndValue)
put
in interface PersistentMap<K,V>
put
in interface ImmutableMap<K,V>
public ImmutableMap<K,V> putAll(PersistentMap<? extends K,? extends V> map)
putAll
in interface PersistentMap<K,V>
putAll
in interface ImmutableMap<K,V>
public LinkedMap<K,V> remove(K key)
remove
in interface PersistentMap<K,V>
remove
in interface ImmutableMap<K,V>
public LinkedMap<K,V> removeAll(K... keys)
removeAll
in interface ImmutableMap<K,V>
public java.lang.String toString()
toString
in class java.lang.Object
public LinkedMap<K,V> filterNot(java.util.function.Predicate<? super Tuple2<K,V>> predicate)
Filters
of(1,2,3).filter(i->i>2);
//[1,2]
public LinkedMap<K,V> notNull()
Filters
of(1,2,null,4).nonNull();
//[1,2,4]
public LinkedMap<K,V> peek(java.util.function.Consumer<? super V> c)
Transformable
of(1,2,3).map(System.out::println)
1
2
3
peek
in interface Transformable<V>
peek
in interface ImmutableMap<K,V>
c
- Consumer that recieves each element from this Transformablepublic LinkedMap<K,V> bipeek(java.util.function.Consumer<? super K> c1, java.util.function.Consumer<? super V> c2)
BiTransformable
MapX<String,Integer> map = MapXs.of("hello",2);
map.bipeek(s->System.out.pritnln("key = " + s),System.out::println);
bipeek
in interface BiTransformable<K,V>
bipeek
in interface ImmutableMap<K,V>
c1
- consumer for the first typec2
- consumer for the second typepublic LinkedMap<K,V> onEmpty(Tuple2<K,V> value)
OnEmpty
public LinkedMap<K,V> onEmptyGet(java.util.function.Supplier<? extends Tuple2<K,V>> supplier)
OnEmpty
onEmptyGet
in interface OnEmpty<Tuple2<K,V>>
onEmptyGet
in interface ImmutableMap<K,V>
supplier
- to determine new value for containerpublic LinkedMap<K,V> onEmptySwitch(java.util.function.Supplier<? extends ImmutableMap<K,V>> supplier)
OnEmptySwitch
Seq.zero().onEmptySwitch(()->Seq.of(1));
onEmptySwitch
in interface OnEmptySwitch<Tuple2<K,V>,ImmutableMap<K,V>>
onEmptySwitch
in interface ImmutableMap<K,V>
supplier
- to create replacement containerpublic <K1,K2,K3,K4,R1,R2,R3,R> LinkedMap<K4,R> forEach4(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1, java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends java.lang.Iterable<Tuple2<K2,R2>>> iterable2, Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? extends java.lang.Iterable<Tuple2<K3,R3>>> iterable3, Function4<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? super Tuple2<K3,R3>,? extends Tuple2<K4,R>> yieldingFunction)
forEach4
in interface ImmutableMap<K,V>
public <K1,K2,K3,K4,R1,R2,R3,R> LinkedMap<K4,R> forEach4(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1, java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends java.lang.Iterable<Tuple2<K2,R2>>> iterable2, Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? extends java.lang.Iterable<Tuple2<K3,R3>>> iterable3, Function4<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? super Tuple2<K3,R3>,java.lang.Boolean> filterFunction, Function4<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? super Tuple2<K3,R3>,? extends Tuple2<K4,R>> yieldingFunction)
forEach4
in interface ImmutableMap<K,V>
public <K1,K2,K3,R1,R2,R> LinkedMap<K3,R> forEach3(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1, java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends java.lang.Iterable<Tuple2<K2,R2>>> iterable2, Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? extends Tuple2<K3,R>> yieldingFunction)
forEach3
in interface ImmutableMap<K,V>
public <K1,K2,K3,R1,R2,R> LinkedMap<K3,R> forEach3(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1, java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends java.lang.Iterable<Tuple2<K2,R2>>> iterable2, Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,java.lang.Boolean> filterFunction, Function3<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? super Tuple2<K2,R2>,? extends Tuple2<K3,R>> yieldingFunction)
forEach3
in interface ImmutableMap<K,V>
public <K1,K2,R1,R> LinkedMap<K2,R> forEach2(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1, java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends Tuple2<K2,R>> yieldingFunction)
forEach2
in interface ImmutableMap<K,V>
public <K1,K2,R1,R> LinkedMap<K2,R> forEach2(java.util.function.Function<? super Tuple2<K,V>,? extends java.lang.Iterable<Tuple2<K1,R1>>> iterable1, java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,java.lang.Boolean> filterFunction, java.util.function.BiFunction<? super Tuple2<K,V>,? super Tuple2<K1,R1>,? extends Tuple2<K2,R>> yieldingFunction)
forEach2
in interface ImmutableMap<K,V>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object