public interface MapX<K,V> extends java.util.Map<K,V>, FluentMapX<K,V>, BiFunctor<K,V>, Functor<V>, IterableFilterable<org.jooq.lambda.tuple.Tuple2<K,V>>, ExtendedTraversable<org.jooq.lambda.tuple.Tuple2<K,V>>, Foldable<org.jooq.lambda.tuple.Tuple2<K,V>>, CyclopsCollectable<org.jooq.lambda.tuple.Tuple2<K,V>>
| Modifier and Type | Method and Description |
|---|---|
default boolean |
allMatch(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> c)
True if predicate matches all elements when Monad converted to a Stream
|
default boolean |
anyMatch(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> c)
True if a single element matches when Monad converted to a Stream
|
default <R1,R2> BiFunctor<R1,R2> |
bimap(java.util.function.Function<? super K,? extends R1> fn1,
java.util.function.Function<? super V,? extends R2> fn2) |
default <U> MapX<K,U> |
cast(java.lang.Class<? extends U> type)
Cast all elements in a stream to a given type, possibly throwing a
ClassCastException. |
default org.jooq.lambda.Collectable<org.jooq.lambda.tuple.Tuple2<K,V>> |
collectable()
Narrow this class to a Collectable
|
static <K,V> java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> |
defaultCollector() |
default MapX<K,V> |
filter(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> fn)
Keep only elements for which the supplied predicates hold
e.g.
|
default MapX<K,V> |
filterNot(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> fn)
Remove any elements for which the predicate holds (inverse operation to filter)
e.g.
|
default <KR,VR> MapX<KR,VR> |
flatMap(java.util.function.BiFunction<? super K,? super V,? extends MapX<KR,VR>> fn) |
static <K,V> MapX<K,V> |
fromMap(java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> collector,
java.util.Map<? extends K,? extends V> it) |
static <K,V> MapX<K,V> |
fromMap(java.util.Map<? extends K,? extends V> it) |
default MapX<K,V> |
fromStream(ReactiveSeq<org.jooq.lambda.tuple.Tuple2<K,V>> stream) |
<K,V> java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> |
getCollector() |
static <K,V> java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> |
immutableCollector() |
default java.util.Iterator<org.jooq.lambda.tuple.Tuple2<K,V>> |
iterator() |
default <R> MapX<K,R> |
map(java.util.function.Function<? super V,? extends R> fn)
Transform this functor using the supplied transformation function
|
default java.util.Optional<org.jooq.lambda.tuple.Tuple2<K,V>> |
max(java.util.Comparator<? super org.jooq.lambda.tuple.Tuple2<K,V>> comparator) |
default java.util.Optional<org.jooq.lambda.tuple.Tuple2<K,V>> |
min(java.util.Comparator<? super org.jooq.lambda.tuple.Tuple2<K,V>> comparator) |
default MapX<K,V> |
minus(java.lang.Object key) |
default MapX<K,V> |
minusAll(java.util.Collection<?> keys) |
default boolean |
noneMatch(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> c) |
default MapX<K,V> |
notNull()
Filter elements retaining only values which are not null
|
default MapX<K,V> |
peek(java.util.function.Consumer<? super V> c)
Peek at the current value of this Functor, without transforming it
|
default MapX<K,V> |
plus(K key,
V value) |
default MapX<K,V> |
plusAll(java.util.Map<? extends K,? extends V> map) |
default MapX<K,V> |
removeAll(java.lang.Iterable<? extends org.jooq.lambda.tuple.Tuple2<K,V>> it)
Remove all elements in the supplied Iterable from this filterable
|
default MapX<K,V> |
removeAll(java.util.stream.Stream<? extends org.jooq.lambda.tuple.Tuple2<K,V>> stream)
Remove all elements in the supplied Stream from this filterable
|
default MapX<K,V> |
removeAll(org.jooq.lambda.tuple.Tuple2<K,V>... values)
Remove all supplied elements from this filterable
|
default MapX<K,V> |
retainAll(java.lang.Iterable<? extends org.jooq.lambda.tuple.Tuple2<K,V>> it)
Retain only the supplied elements in the returned Filterable
|
default MapX<K,V> |
retainAll(java.util.stream.Stream<? extends org.jooq.lambda.tuple.Tuple2<K,V>> stream)
Retain only the supplied elements in the returned Filterable
|
default MapX<K,V> |
retainAll(org.jooq.lambda.tuple.Tuple2<K,V>... values)
Retain only the supplied elements in the returned Filterable
|
int |
size() |
default ReactiveSeq<org.jooq.lambda.tuple.Tuple2<K,V>> |
stream() |
static <K,V> java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> |
toMapX() |
default <R> MapX<K,R> |
trampoline(java.util.function.Function<? super V,? extends Trampoline<? extends R>> mapper)
Performs a map operation that can call a recursive method without running out of stack space
|
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, valuesbicast, bipeek, bitrampolinepatternMatchofTypecombinations, combinations, permutationscombine, cycle, cycle, cycleUntil, cycleWhile, distinct, dropRight, dropUntil, dropWhile, futureOperations, grouped, grouped, grouped, grouped, groupedStatefullyWhile, groupedUntil, groupedUntil, groupedWhile, groupedWhile, intersperse, lazyOperations, limit, limitLast, limitUntil, limitWhile, onEmpty, onEmptyGet, onEmptyThrow, reverse, scanLeft, scanLeft, scanRight, scanRight, shuffle, shuffle, skip, skipLast, skipUntil, skipWhile, slice, sliding, sliding, sorted, sorted, sorted, subscribe, takeRight, takeUntil, takeWhile, traversable, zip, zip, zip3, zip4, zipStream, zipWithIndexgroupedStatefullyWhileT, groupedT, groupedUntilT, groupedWhileT, slidingT, slidingTendsWith, endsWithIterable, findAny, findFirst, firstValue, foldable, foldRight, foldRight, foldRight, foldRightMapToType, get, groupBy, headAndTail, join, join, join, mapReduce, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, single, single, singleOptional, startsWith, startsWithIterable, toConcurrentLazyCollection, toConcurrentLazyStreamable, toLazyCollection, validate, visit, visit, xMatchseq, toCompletableFuture, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFutureStream, toFutureStream, toFutureW, toIor, toIorSecondary, toListX, toMapX, toMaybe, toOptional, toPBagX, toPMapX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toStreamable, toTry, toValue, toValueMap, toValueSet, toXor, toXorSecondaryavg, avg, avgDouble, avgInt, avgLong, bitAnd, bitAnd, bitAndInt, bitAndLong, bitOr, bitOr, bitOrInt, bitOrLong, collect, commonPrefix, commonSuffix, count, count, countDistinct, countDistinct, countDistinctBy, countDistinctBy, max, max, max, maxAll, maxAll, maxAll, maxAll, maxAllBy, maxAllBy, maxBy, maxBy, median, median, medianBy, medianBy, min, min, min, minAll, minAll, minAll, minAll, minAllBy, minAllBy, minBy, minBy, mode, modeAll, modeAllBy, modeBy, percentile, percentile, percentileBy, percentileBy, sum, sum, sumDouble, sumInt, sumLong, toCollection, toList, toList, toMap, toMap, toSet, toSet, toString, toStringstatic <K,V> java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> defaultCollector()
static <K,V> java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> immutableCollector()
static <K,V> java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> toMapX()
<K,V> java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> getCollector()
default ReactiveSeq<org.jooq.lambda.tuple.Tuple2<K,V>> stream()
stream in interface ConvertableSequence<org.jooq.lambda.tuple.Tuple2<K,V>>stream in interface ExtendedTraversable<org.jooq.lambda.tuple.Tuple2<K,V>>stream in interface Foldable<org.jooq.lambda.tuple.Tuple2<K,V>>stream in interface TransformerTraversable<org.jooq.lambda.tuple.Tuple2<K,V>>stream in interface Traversable<org.jooq.lambda.tuple.Tuple2<K,V>>static <K,V> MapX<K,V> fromMap(java.util.Map<? extends K,? extends V> it)
static <K,V> MapX<K,V> fromMap(java.util.stream.Collector<org.jooq.lambda.tuple.Tuple2<? extends K,? extends V>,?,java.util.Map<K,V>> collector, java.util.Map<? extends K,? extends V> it)
default org.jooq.lambda.Collectable<org.jooq.lambda.tuple.Tuple2<K,V>> collectable()
CyclopsCollectablecollectable in interface CyclopsCollectable<org.jooq.lambda.tuple.Tuple2<K,V>>default <KR,VR> MapX<KR,VR> flatMap(java.util.function.BiFunction<? super K,? super V,? extends MapX<KR,VR>> fn)
default <R> MapX<K,R> map(java.util.function.Function<? super V,? extends R> fn)
Functor
of(1,2,3).map(i->i*2)
//[2,4,6]
default <R1,R2> BiFunctor<R1,R2> bimap(java.util.function.Function<? super K,? extends R1> fn1, java.util.function.Function<? super V,? extends R2> fn2)
default boolean allMatch(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> c)
CyclopsCollectable
assertThat(ReactiveSeq.of(1,2,3,4,5).allMatch(it-> it>0 && it <6),equalTo(true));
default boolean anyMatch(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> c)
CyclopsCollectable
assertThat(ReactiveSeq.of(1,2,3,4,5).anyMatch(it-> it.equals(3)),equalTo(true));
default boolean noneMatch(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> c)
default java.util.Optional<org.jooq.lambda.tuple.Tuple2<K,V>> max(java.util.Comparator<? super org.jooq.lambda.tuple.Tuple2<K,V>> comparator)
default java.util.Optional<org.jooq.lambda.tuple.Tuple2<K,V>> min(java.util.Comparator<? super org.jooq.lambda.tuple.Tuple2<K,V>> comparator)
default MapX<K,V> plusAll(java.util.Map<? extends K,? extends V> map)
plusAll in interface FluentMapX<K,V>default MapX<K,V> minus(java.lang.Object key)
minus in interface FluentMapX<K,V>default MapX<K,V> minusAll(java.util.Collection<?> keys)
minusAll in interface FluentMapX<K,V>default <U> MapX<K,U> cast(java.lang.Class<? extends U> type)
FunctorClassCastException.
// ClassCastException ReactiveSeq.of(1, "a", 2, "b", 3).cast(Integer.class)default MapX<K,V> peek(java.util.function.Consumer<? super V> c)
Functor
of(1,2,3).map(System.out::println)
1
2
3
default <R> MapX<K,R> trampoline(java.util.function.Function<? super V,? extends Trampoline<? extends R>> mapper)
Functor
ReactiveSeq.of(10,20,30,40)
.trampoline(i-> fibonacci(i))
.forEach(System.out::println);
Trampoline<Long> fibonacci(int i){
return fibonacci(i,1,0);
}
Trampoline<Long> fibonacci(int n, long a, long b) {
return n == 0 ? Trampoline.done(b) : Trampoline.more( ()->fibonacci(n-1, a+b, a));
}
55
6765
832040
102334155
ReactiveSeq.of(10_000,200_000,3_000_000,40_000_000)
.trampoline(i-> fibonacci(i))
.forEach(System.out::println);
completes successfully
trampoline in interface Functor<V>default MapX<K,V> filter(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> fn)
Filterable
of(1,2,3).filter(i->i>2);
//[3]
filter in interface Filterable<org.jooq.lambda.tuple.Tuple2<K,V>>fn - to filter elements by, retaining matchesdefault MapX<K,V> filterNot(java.util.function.Predicate<? super org.jooq.lambda.tuple.Tuple2<K,V>> fn)
Filterable
of(1,2,3).filter(i->i>2);
//[1,2]
filterNot in interface Filterable<org.jooq.lambda.tuple.Tuple2<K,V>>fn - to filter elements by, retaining matchesdefault MapX<K,V> notNull()
Filterable
of(1,2,null,4).nonNull();
//[1,2,4]
notNull in interface Filterable<org.jooq.lambda.tuple.Tuple2<K,V>>default MapX<K,V> removeAll(java.util.stream.Stream<? extends org.jooq.lambda.tuple.Tuple2<K,V>> stream)
IterableFilterableremoveAll in interface IterableFilterable<org.jooq.lambda.tuple.Tuple2<K,V>>stream - of elements to removedefault MapX<K,V> removeAll(java.lang.Iterable<? extends org.jooq.lambda.tuple.Tuple2<K,V>> it)
IterableFilterableremoveAll in interface IterableFilterable<org.jooq.lambda.tuple.Tuple2<K,V>>it - an Iterable of elements to removedefault MapX<K,V> removeAll(org.jooq.lambda.tuple.Tuple2<K,V>... values)
IterableFilterableremoveAll in interface IterableFilterable<org.jooq.lambda.tuple.Tuple2<K,V>>values - to removedefault MapX<K,V> retainAll(java.lang.Iterable<? extends org.jooq.lambda.tuple.Tuple2<K,V>> it)
IterableFilterableretainAll in interface IterableFilterable<org.jooq.lambda.tuple.Tuple2<K,V>>it - Iterable of elements to retaindefault MapX<K,V> retainAll(java.util.stream.Stream<? extends org.jooq.lambda.tuple.Tuple2<K,V>> stream)
IterableFilterableretainAll in interface IterableFilterable<org.jooq.lambda.tuple.Tuple2<K,V>>stream - of elements to retaindefault MapX<K,V> retainAll(org.jooq.lambda.tuple.Tuple2<K,V>... values)
IterableFilterableretainAll in interface IterableFilterable<org.jooq.lambda.tuple.Tuple2<K,V>>values - elements to retain