public interface IterableFoldable<T> extends Foldable<T>, java.lang.Iterable<T>
Modifier and Type | Method and Description |
---|---|
default IterableFoldable<T> |
foldable() |
default HeadAndTail<T> |
headAndTail()
extract head and tail together, where head is expected to be present
|
default <R> R |
visit(java.util.function.BiFunction<? super T,? super ReactiveSeq<T>,? extends R> match,
java.util.function.Supplier<? extends R> ifEmpty)
Destructures this Traversable into it's head and tail.
|
endsWith, endsWithIterable, findAny, findFirst, firstValue, foldRight, foldRight, foldRight, foldRightMapToType, get, groupBy, join, join, join, mapReduce, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, single, single, singleOptional, startsWith, startsWithIterable, stream, toConcurrentLazyCollection, toConcurrentLazyStreamable, toLazyCollection, validate, xMatch
default IterableFoldable<T> foldable()
default <R> R visit(java.util.function.BiFunction<? super T,? super ReactiveSeq<T>,? extends R> match, java.util.function.Supplier<? extends R> ifEmpty)
ListX.of(1,2,3,4,5,6,7,8,9)
.dropRight(5)
.plus(10)
.visit((x,xs) ->
xs.join(x.>2?"hello":"world")),()->"NIL"
);
//2world3world4
match
- default HeadAndTail<T> headAndTail()
{ @code SequenceM<String> helloWorld = ReactiveSeq.of("hello", "world", "last"); HeadAndTail<String> headAndTail = helloWorld.headAndTail(); String head = headAndTail.head(); assertThat(head, equalTo("hello")); SequenceM<String> tail = headAndTail.tail(); assertThat(tail.headAndTail().head(), equalTo("world")); }