T
- Data type for Streampublic interface Streamable<T> extends ToStream<T>, IterableFoldable<T>, CyclopsCollectable<T>, ConvertableSequence<T>, Functor<T>, Filterable<T>, Traversable<T>, Unit<T>, ZippingApplicativable<T>
Modifier and Type | Interface and Description |
---|---|
static class |
Streamable.Impl |
static class |
Streamable.PrintableIterable<T> |
Modifier and Type | Method and Description |
---|---|
default boolean |
allMatch(java.util.function.Predicate<? super T> c)
True if predicate matches all elements when Monad converted to a Stream
|
default AnyM<T> |
anyM() |
default boolean |
anyMatch(java.util.function.Predicate<? super T> c)
True if a single element matches when Monad converted to a Stream
|
default Streamable<T> |
append(T... values)
Append values to the end of this Streamable
|
default Streamable<T> |
appendAll(Streamable<T> t)
Create a new Streamablw with all elements in this Streamable followed by the elements in the provided Streamable
|
default Streamable<T> |
appendStreamable(Streamable<T> stream)
Append Stream to this Streamable
|
default <U> Streamable<U> |
cast(java.lang.Class<? extends U> type)
Cast all elements in a stream to a given type, possibly throwing a
ClassCastException . |
default <R,A> R |
collect(java.util.stream.Collector<? super T,A,R> collector) |
default <R> R |
collect(java.util.function.Supplier<R> supplier,
java.util.function.BiConsumer<R,? super T> accumulator,
java.util.function.BiConsumer<R,R> combiner) |
default org.jooq.lambda.Collectable<T> |
collectable()
Narrow this class to a Collectable
|
default Streamable<Streamable<T>> |
combinations()
Streamable.of(1,2,3).combinations()
//Streamable[Streamable[],Streamable[1],Streamable[2],Streamable[3],Streamable[1,2],Streamable[1,3],Streamable[2,3]
,Streamable[1,2,3]]
|
default Streamable<Streamable<T>> |
combinations(int size)
Streamable.of(1,2,3).combinations(2)
//Streamable[Streamable[1,2],Streamable[1,3],Streamable[2,3]]
|
default Streamable<T> |
combine(java.util.function.BiPredicate<? super T,? super T> predicate,
java.util.function.BinaryOperator<T> op)
Combine two adjacent elements in a traversable using the supplied BinaryOperator
This is a stateful grouping & reduction operation.
|
default Streamable<T> |
concat(Streamable<T> other) |
default Streamable<T> |
concat(T... other) |
default Streamable<T> |
concat(T other) |
default boolean |
contains(T t)
True if a streamable contains element t
|
default long |
count() |
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> |
crossJoin(Streamable<U> other) |
default Streamable<T> |
cycle()
Convert to a Stream with the values infinitely cycled
|
default Streamable<T> |
cycle(int times)
Convert to a Stream with the values repeated specified times
|
default Streamable<T> |
cycle(Monoid<T> m,
int times)
Convert to a Stream with the result of a reduction operation repeated
specified times
|
default Streamable<T> |
cycleUntil(java.util.function.Predicate<? super T> predicate)
Repeat in a Stream until specified predicate holds
|
default Streamable<T> |
cycleWhile(java.util.function.Predicate<? super T> predicate)
Repeat in a Stream while specified predicate holds
|
default Streamable<T> |
debounce(long time,
java.util.concurrent.TimeUnit t)
Allow one element through per time period, drop all other
elements in that time period
|
default Streamable<T> |
deleteBetween(int start,
int end)
Delete elements between given indexes in a Stream
|
default Streamable<T> |
distinct() |
default <U> Streamable<T> |
distinct(java.util.function.Function<? super T,? extends U> keyExtractor) |
default Streamable<T> |
dropRight(int num) |
default Streamable<T> |
dropUntil(java.util.function.Predicate<? super T> p) |
default Streamable<T> |
dropWhile(java.util.function.Predicate<? super T> p) |
default org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<T>> |
duplicate()
Duplicate a Stream, buffers intermediate values, leaders may change positions so a limit
can be safely applied to the leading stream.
|
default Streamable<org.jooq.lambda.tuple.Tuple2<T,java.lang.Long>> |
elapsed()
Streamable.of(1,2,3,4,5)
.elapsed()
.forEach(System.out::println);
|
default T |
elementAt(int index)
Gets the element at index (it must be present)
|
default org.jooq.lambda.tuple.Tuple2<T,Streamable<T>> |
elementAt(long index)
Gets the element at index, and returns a Tuple containing the element (it must be present)
and a lazy copy of the Sequence for further processing.
|
static <T> Streamable<T> |
empty() |
default boolean |
endsWith(Streamable<T> stream)
assertTrue(Streamable.of(1,2,3,4,5,6)
.endsWith(Stream.of(5,6)));
|
default boolean |
endsWithIterable(java.lang.Iterable<T> iterable)
assertTrue(Streamable.of(1,2,3,4,5,6)
.endsWith(Arrays.asList(5,6)));
|
default Streamable<T> |
filter(java.util.function.Predicate<? super T> fn)
Keep only elements for which the supplied predicates hold
e.g.
|
default java.util.Optional<T> |
findAny() |
default java.util.Optional<T> |
findFirst() |
default T |
firstValue()
assertThat(Streamable.of(1,2,3,4)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
|
default Streamable<T> |
fixedDelay(long l,
java.util.concurrent.TimeUnit unit)
emit elements after a fixed delay
|
default <R> Streamable<R> |
flatMap(java.util.function.Function<? super T,Streamable<? extends R>> fn) |
default <R> Streamable<R> |
flatMapAnyM(java.util.function.Function<? super T,AnyM<? extends R>> fn)
Allows flatMap return type to be any Monad type
|
default <R> Streamable<R> |
flatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> fn)
FlatMap where the result is a Collection, flattens the resultant collections into the
host Streamable
|
default <R> Streamable<R> |
flatMapStream(java.util.function.Function<? super T,java.util.stream.BaseStream<? extends R,?>> fn)
flatMap operation
|
default <T1> Streamable<T1> |
flatten()
join / flatten one level of a nested hierarchy
|
default <U> U |
foldLeft(U identity,
java.util.function.BiFunction<U,? super T,U> function)
Fold a Streamable Left
|
default T |
foldRight(Monoid<T> reducer)
Streamable.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
|
default T |
foldRight(T identity,
java.util.function.BinaryOperator<T> accumulator)
Immutable reduction from right to left
|
default <U> U |
foldRight(U seed,
java.util.function.BiFunction<? super T,? super U,? extends U> function)
Fold a Streamable fromt the right
|
default <T> T |
foldRightMapToType(Reducer<T> reducer)
Attempt to map this Monad to the same type as the supplied Monoid (using mapToType on the monoid interface)
Then use Monoid to reduce values
|
default void |
forEachOrdered(java.util.function.Consumer<? super T> action) |
static Streamable<java.lang.Double> |
fromDoubleStream(java.util.stream.DoubleStream stream)
Construct a Sequence from a Stream
|
static Streamable<java.lang.Integer> |
fromIntStream(java.util.stream.IntStream stream)
Construct a Sequence from a Stream
|
static <T> Streamable<T> |
fromIterable(java.lang.Iterable<T> iterable)
(Lazily) Construct a Streamable from an Iterable.
|
static <T> Streamable<T> |
fromIterator(java.util.Iterator<T> it) |
static <T> Streamable<T> |
fromList(java.util.List<T> list) |
static Streamable<java.lang.Long> |
fromLongStream(java.util.stream.LongStream stream)
Construct a Sequence from a Stream
|
static <T> Streamable<T> |
fromObject(java.lang.Object toCoerce) |
static <T> Streamable<T> |
fromPublisher(org.reactivestreams.Publisher<? extends T> publisher)
Construct a LazyFutureStream from an Publisher
|
static <T> Streamable<T> |
fromStream(java.util.stream.Stream<T> stream)
(Lazily) Construct a Streamable from a Stream.
|
default FutureOperations<T> |
futureOperations(java.util.concurrent.Executor exec)
Access asynchronous terminal operations (each returns a Future)
|
static <T> Streamable<T> |
generate(java.util.function.Supplier<T> s) |
default java.util.Optional<T> |
get(long index)
Return the elementAt index or Optional.empty
|
default <K> MapX<K,java.util.List<T>> |
groupBy(java.util.function.Function<? super T,? extends K> classifier)
Use classifier function to group elements in this Sequence into a Map
|
default <K> Streamable<org.jooq.lambda.tuple.Tuple2<K,org.jooq.lambda.Seq<T>>> |
grouped(java.util.function.Function<? super T,? extends K> classifier) |
default <K,A,D> Streamable<org.jooq.lambda.tuple.Tuple2<K,D>> |
grouped(java.util.function.Function<? super T,? extends K> classifier,
java.util.stream.Collector<? super T,A,D> downstream) |
default Streamable<ListX<T>> |
grouped(int groupSize)
Group elements in a Stream
|
default <C extends java.util.Collection<? super T>> |
grouped(int size,
java.util.function.Supplier<C> supplier)
Batch elements in a Stream by size into a collection created by the supplied factory
|
default Streamable<ListX<T>> |
groupedBySizeAndTime(int size,
long time,
java.util.concurrent.TimeUnit t)
Batch elements by size into a List
|
default <C extends java.util.Collection<? super T>> |
groupedBySizeAndTime(int size,
long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory)
Batch elements by size into a collection created by the supplied factory
|
default Streamable<ListX<T>> |
groupedByTime(long time,
java.util.concurrent.TimeUnit t)
Batch elements in a Stream by time period
|
default <C extends java.util.Collection<? super T>> |
groupedByTime(long time,
java.util.concurrent.TimeUnit unit,
java.util.function.Supplier<C> factory)
Batch elements by time into a collection created by the supplied factory
|
default Streamable<ListX<T>> |
groupedStatefullyUntil(java.util.function.BiPredicate<ListX<? super T>,? super T> predicate)
Create Travesable of Lists where
each List is populated while the supplied bipredicate holds.
|
default Streamable<ListX<T>> |
groupedUntil(java.util.function.Predicate<? super T> predicate)
Create a Streamable batched by List, where each batch is populated until the predicate holds
|
default <C extends java.util.Collection<? super T>> |
groupedUntil(java.util.function.Predicate<? super T> predicate,
java.util.function.Supplier<C> factory)
Create a Streamable batched by a Collection, where each batch is populated until the predicate holds
|
default Streamable<ListX<T>> |
groupedWhile(java.util.function.Predicate<? super T> predicate)
Create a Streamable batched by List, where each batch is populated while the predicate holds
|
default <C extends java.util.Collection<? super T>> |
groupedWhile(java.util.function.Predicate<? super T> predicate,
java.util.function.Supplier<C> factory)
Create a Streamable batched by a Collection, where each batch is populated while the predicate holds
|
default T |
head()
Streamable.of(1,2,3,4,5).head()
//1
|
default HotStream<T> |
hotStream(java.util.concurrent.Executor e)
Turns this Streamable into a HotStream, a connectable Stream, being executed on a thread on the
supplied executor, that is producing data
|
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> |
innerJoin(Streamable<U> other,
java.util.function.BiPredicate<T,U> predicate) |
default Streamable<T> |
insertAt(int pos,
T... values)
Insert data into a stream at given position
|
default Streamable<T> |
insertStreamableAt(int pos,
Streamable<T> stream)
Insert a Stream into the middle of this stream at the specified position
|
default Streamable<T> |
intersperse(T value)
Returns a stream with a given value interspersed between any two values
of this stream.
|
static <T> Streamable<T> |
iterate(T seed,
java.util.function.UnaryOperator<T> f) |
default java.util.Iterator<T> |
iterator() |
default Streamable<T> |
jitter(long maxJitterPeriodInNanos)
Introduce a random jitter / time delay between the emission of elements
|
default java.lang.String |
join()
assertEquals("123".length(),Streamable.of(1, 2, 3).join().length());
|
default java.lang.String |
join(java.lang.String sep)
assertEquals("1, 2, 3".length(), Streamable.of(1, 2, 3).join(", ").length());
|
default java.lang.String |
join(java.lang.String sep,
java.lang.String start,
java.lang.String end)
assertEquals("^1|2|3$".length(), of(1, 2, 3).join("|", "^", "$").length());
|
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> |
leftOuterJoin(Streamable<U> other,
java.util.function.BiPredicate<T,U> predicate) |
default Streamable<T> |
limit(long num)
assertThat(Streamable.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3)); |
default Streamable<T> |
limit(long time,
java.util.concurrent.TimeUnit unit)
Return all elements until specified time period has elapsed
|
default Streamable<T> |
limitLast(int num)
Limit results to the last x elements in a Streamable
|
default Streamable<T> |
limitUntil(java.util.function.Predicate<? super T> p)
assertThat(Streamable.of(4,3,6,7).limitUntil(i->i==6).toList(),equalTo(Arrays.asList(4,3))); |
default Streamable<T> |
limitWhile(java.util.function.Predicate<? super T> p)
assertThat(Streamable.of(4,3,6,7).sorted().limitWhile(i->i<6).toList(),equalTo(Arrays.asList(3,4))); |
default <R> Streamable<R> |
map(java.util.function.Function<? super T,? extends R> fn)
Map the values in the Streamable from one set of values / types to another
|
default <R> R |
mapReduce(java.util.function.Function<? super T,? extends R> mapper,
Monoid<R> reducer)
Attempt to map this Monad to the same type as the supplied Monoid, using supplied function
Then use Monoid to reduce values
|
default <R> R |
mapReduce(Reducer<R> reducer)
Attempt to map this Sequence to the same type as the supplied Monoid (Reducer)
Then use Monoid to reduce values
|
default java.util.Optional<T> |
max(java.util.Comparator<? super T> comparator) |
default <C extends java.lang.Comparable<? super C>> |
maxBy(java.util.function.Function<? super T,? extends C> f)
Extract the maximum as determined by the supplied function
|
default java.util.Optional<T> |
min(java.util.Comparator<? super T> comparator) |
default <C extends java.lang.Comparable<? super C>> |
minBy(java.util.function.Function<? super T,? extends C> f)
Extract the minimum as determined by supplied function
|
default boolean |
noneMatch(java.util.function.Predicate<? super T> c) |
static <T> Streamable<T> |
of(T... values)
Construct a Streamable that returns a Stream
|
default <U> Streamable<U> |
ofType(java.lang.Class<? extends U> type)
Keep only those elements in a stream that are of a given type.
|
default Streamable<T> |
onEmpty(T value)
If this Container instance is empty, create a new instance containing the provided value
|
default Streamable<T> |
onEmptyGet(java.util.function.Supplier<? extends T> supplier)
If this Container instance is empty, create a new instance containing the value returned from the provided Supplier
|
default Streamable<T> |
onEmptySwitch(java.util.function.Supplier<Streamable<T>> switchTo)
If this Streamable is empty replace it with a another Stream
|
default <X extends java.lang.Throwable> |
onEmptyThrow(java.util.function.Supplier<? extends X> supplier)
If this container instance is empty, throw the exception returned by the provided Supplier
|
default Streamable<T> |
onePer(long time,
java.util.concurrent.TimeUnit t)
emit one element per time period
|
default org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<T>> |
partition(java.util.function.Predicate<T> splitter)
Partition a Stream into two one a per element basis, based on predicate's boolean value
|
default Streamable<T> |
peek(java.util.function.Consumer<? super T> fn)
Peek at each value in a Streamable as it passes through unchanged
|
default Streamable<Streamable<T>> |
permutations()
Generate the permutations based on values in the Streamable
|
default Streamable<T> |
prepend(T... values)
Prepend given values to the start of the Stream
|
default Streamable<T> |
prepend(T t)
Prepend given values to the start of the Stream
|
default Streamable<T> |
prependStreamable(Streamable<T> stream)
Prepend Stream to this Streamable
|
default org.jooq.lambda.tuple.Tuple4<Streamable<T>,Streamable<T>,Streamable<T>,Streamable<T>> |
quadruplicate() |
static Streamable<java.lang.Integer> |
range(int start,
int end)
Create an efficiently reversable Sequence that produces the integers between start
and end
|
static Streamable<java.lang.Long> |
rangeLong(long start,
long end)
Create an efficiently reversable Sequence that produces the integers between start
and end
|
default <EX extends java.lang.Throwable> |
recover(java.lang.Class<EX> exceptionClass,
java.util.function.Function<EX,T> fn)
Recover from a particular exception type
|
default Streamable<T> |
recover(java.util.function.Function<java.lang.Throwable,? extends T> fn)
Recover from an exception with an alternative value
|
default java.util.Optional<T> |
reduce(java.util.function.BinaryOperator<T> accumulator) |
default ListX<T> |
reduce(java.lang.Iterable<? extends Monoid<T>> reducers)
Reduce with multiple reducers in parallel
NB if this Monad is an Optional [Arrays.asList(1,2,3)] reduce will operate on the Optional as if the list was one value
To reduce over the values on the list, called streamedMonad() first.
|
default T |
reduce(Monoid<T> reducer)
Streamable.of("hello","2","world","4").reduce(Reducers.toString(","));
//hello,2,world,4
|
default ListX<T> |
reduce(java.util.stream.Stream<? extends Monoid<T>> reducers)
Reduce with multiple reducers in parallel
NB if this Monad is an Optional [Arrays.asList(1,2,3)] reduce will operate on the Optional as if the list was one value
To reduce over the values on the list, called streamedMonad() first.
|
default T |
reduce(T identity,
java.util.function.BinaryOperator<T> accumulator) |
default <U> U |
reduce(U identity,
java.util.function.BiFunction<U,? super T,U> accumulator,
java.util.function.BinaryOperator<U> combiner) |
default Streamable<T> |
remove(T t)
Remove all occurances of the specified element from the SequenceM
|
default <R> Streamable<R> |
retry(java.util.function.Function<T,R> fn)
Retry a transformation if it fails.
|
default Streamable<T> |
reverse() |
static <T> Streamable<T> |
reversedListOf(java.util.List<T> elements)
Construct a Reveresed Sequence from the provided elements
Can be reversed (again) efficiently
|
static <T> Streamable<T> |
reversedOf(T... elements)
Construct a Reveresed Sequence from the provided elements
Can be reversed (again) efficiently
|
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> |
rightOuterJoin(Streamable<U> other,
java.util.function.BiPredicate<T,U> predicate) |
default Streamable<T> |
scanLeft(Monoid<T> monoid)
Scan left using supplied Monoid
|
default <U> Streamable<U> |
scanLeft(U identity,
java.util.function.BiFunction<? super U,? super T,? extends U> function)
Scan left
|
default Streamable<T> |
scanRight(Monoid<T> monoid)
Scan right
|
default <U> Streamable<U> |
scanRight(U identity,
java.util.function.BiFunction<? super T,? super U,? extends U> combiner)
Scan right
|
default Streamable<T> |
shuffle() |
default Streamable<T> |
shuffle(java.util.Random random) |
default T |
single()
assertThat(Streamable.of(1).single(),equalTo(1));
|
default int |
size()
[equivalent to count]
|
default Streamable<T> |
skip(long num)
assertThat(Streamable.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7))); |
default Streamable<T> |
skip(long time,
java.util.concurrent.TimeUnit unit)
Skip all elements until specified time period has passed
|
default Streamable<T> |
skipLast(int num)
assertThat(Streamable.of(1,2,3,4,5)
.skipLast(2)
.collect(Collectors.toList()),equalTo(Arrays.asList(1,2,3)));
|
default Streamable<T> |
skipUntil(java.util.function.Predicate<? super T> p)
assertThat(Streamable.of(4,3,6,7).skipUntil(i->i==6).toList(),equalTo(Arrays.asList(6,7))); |
default Streamable<T> |
skipWhile(java.util.function.Predicate<? super T> p)
assertThat(Streamable.of(4,3,6,7).sorted().skipWhile(i->i<6).toList(),equalTo(Arrays.asList(6,7)));
|
default Streamable<T> |
slice(long from,
long to) |
default Streamable<ListX<T>> |
sliding(int windowSize)
Create a sliding view over this Sequence
|
default Streamable<ListX<T>> |
sliding(int windowSize,
int increment)
Create a sliding view over this Sequence
|
default Streamable<T> |
sorted()
assertThat(Streamable.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7))); |
default Streamable<T> |
sorted(java.util.Comparator<? super T> c)
assertThat(Streamable.of(4,3,6,7).sorted((a,b) -> b-a).toList(),equalTo(Arrays.asList(7,6,4,3)));
|
default <U extends java.lang.Comparable<? super U>> |
sorted(java.util.function.Function<? super T,? extends U> function) |
default org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<T>> |
splitAt(int where)
Split at supplied location
|
default org.jooq.lambda.tuple.Tuple2<java.util.Optional<T>,Streamable<T>> |
splitAtHead()
Split this Streamable after the first element (if present)
|
default org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<T>> |
splitBy(java.util.function.Predicate<T> splitter)
Split stream at point where predicate no longer holds
|
default boolean |
startsWith(java.util.stream.Stream<T> iterator)
assertTrue(Streamable.of(1,2,3,4).startsWith(Stream.of(1,2,3))) |
default boolean |
startsWithIterable(java.lang.Iterable<T> iterable)
assertTrue(Streamable.of(1,2,3,4).startsWith(Arrays.asList(1,2,3)));
|
default ReactiveSeq<T> |
stream() |
default Streamable<T> |
subStream(int start,
int end)
Return a Streamable with elements before the provided start index removed, and elements after the provided
end index removed
|
static <T> Streamable<T> |
synchronizedFromIterable(java.lang.Iterable<T> toCoerce) |
static <T> Streamable<T> |
synchronizedFromStream(java.util.stream.Stream<T> toCoerce) |
default Streamable<T> |
tail()
Streamable.of(1,2,3,4,5).tail()
//Streamable[2,3,4,5]
|
default Streamable<T> |
takeRight(int num) |
default Streamable<T> |
takeUntil(java.util.function.Predicate<? super T> p) |
default Streamable<T> |
takeWhile(java.util.function.Predicate<? super T> p) |
default Streamable<org.jooq.lambda.tuple.Tuple2<T,java.lang.Long>> |
timestamp()
Streamable.of(1,2,3,4,5)
.timestamp()
.forEach(System.out::println)
|
default java.lang.Object[] |
toArray() |
default <A> A[] |
toArray(java.util.function.IntFunction<A[]> generator) |
default <C extends java.util.Collection<T>> |
toCollection(java.util.function.Supplier<C> collectionFactory)
Add the contents of this Stream to the mutable collection supplied by
the provided collectionFactory
|
default java.util.concurrent.CompletableFuture<ListX<T>> |
toCompletableFuture()
CompletableFuture<List<String>> cf = Streamable.of("hello","world")
.toCompletableFuture();
assertThat(cf.join(),equalTo(Arrays.asList("hello","world")));
|
default CollectionX<T> |
toConcurrentLazyCollection()
Lazily converts this Streamable into a Collection.
|
default CollectionX<T> |
toLazyCollection()
Lazily converts this Streamable into a Collection.
|
default java.util.List<T> |
toList()
Streamable.of(1,2,3)
.toList();
//List[1,2,3]
|
default java.util.Optional<ListX<T>> |
toOptional()
Type safe unwrap
|
default org.jooq.lambda.tuple.Tuple3<Streamable<T>,Streamable<T>,Streamable<T>> |
triplicate() |
default <T> Streamable<T> |
unit(T t) |
default <T> Streamable<T> |
unitIterator(java.util.Iterator<T> it)
Create an IterableFunctor instance of the same type from an Iterator
|
static <T,U> org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<U>> |
unzip(Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> sequence)
Unzip a zipped Stream
|
static <T1,T2,T3> org.jooq.lambda.tuple.Tuple3<Streamable<T1>,Streamable<T2>,Streamable<T3>> |
unzip3(Streamable<org.jooq.lambda.tuple.Tuple3<T1,T2,T3>> sequence)
Unzip a zipped Stream into 3
|
static <T1,T2,T3,T4> |
unzip4(Streamable<org.jooq.lambda.tuple.Tuple4<T1,T2,T3,T4>> sequence)
Unzip a zipped Stream into 4
|
default boolean |
xMatch(int num,
java.util.function.Predicate<? super T> c)
Check that there are specified number of matches of predicate in the Stream
|
default Streamable<T> |
xPer(int x,
long time,
java.util.concurrent.TimeUnit t)
emit x elements per time period
|
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> |
zip(java.lang.Iterable<? extends U> other)
Zip 2 streams into one
|
default <U,R> Streamable<R> |
zip(java.lang.Iterable<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zip (combine) this Zippable with the supplied Iterable using the supplied combining function
|
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> |
zip(org.jooq.lambda.Seq<? extends U> other)
Zip (combine) this Zippable with the supplied Seq combining both into a Tuple2
|
default <U,R> Streamable<R> |
zip(org.jooq.lambda.Seq<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zip (combine) this Zippable with the supplied Seq, using the supplied combining function
|
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> |
zip(java.util.stream.Stream<? extends U> other)
Zip 2 streams into one
|
default <U,R> Streamable<R> |
zip(java.util.stream.Stream<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zip (combine) this Zippable with the supplied Stream, using the supplied combining function
|
default <S,U> Streamable<org.jooq.lambda.tuple.Tuple3<T,S,U>> |
zip3(java.util.stream.Stream<? extends S> second,
java.util.stream.Stream<? extends U> third)
zip 3 Streams into one
|
default <S,U> Streamable<org.jooq.lambda.tuple.Tuple3<T,S,U>> |
zip3(Streamable<? extends S> second,
Streamable<? extends U> third)
zip 3 Streams into one
|
default <T2,T3,T4> Streamable<org.jooq.lambda.tuple.Tuple4<T,T2,T3,T4>> |
zip4(java.util.stream.Stream<? extends T2> second,
java.util.stream.Stream<? extends T3> third,
java.util.stream.Stream<? extends T4> fourth)
zip 4 Streams into 1
|
default <T2,T3,T4> Streamable<org.jooq.lambda.tuple.Tuple4<T,T2,T3,T4>> |
zip4(Streamable<? extends T2> second,
Streamable<? extends T3> third,
Streamable<? extends T4> fourth)
zip 4 Streams into 1
|
default <S,R> Streamable<R> |
zipStream(java.util.stream.BaseStream<? extends S,? extends java.util.stream.BaseStream<? extends S,?>> second,
java.util.function.BiFunction<? super T,? super S,? extends R> zipper)
Zip this Monad with a Stream
|
default Streamable<org.jooq.lambda.tuple.Tuple2<T,java.lang.Long>> |
zipWithIndex()
Add an index to the current Stream
|
futureStream, getStreamable, isEmpty, jdkStream, reactiveSeq, reveresedJDKStream, reveresedStream
foldable, headAndTail, visit
avg, avg, avgDouble, avgInt, avgLong, bitAnd, bitAnd, bitAndInt, bitAndLong, bitOr, bitOr, bitOrInt, bitOrLong, commonPrefix, commonSuffix, count, countDistinct, countDistinct, countDistinctBy, countDistinctBy, max, max, max, maxAll, maxAll, maxAll, maxAll, maxAllBy, maxAllBy, maxBy, median, median, medianBy, medianBy, min, min, min, minAll, minAll, minAll, minAll, minAllBy, minAllBy, minBy, mode, modeAll, modeAllBy, modeBy, percentile, percentile, percentileBy, percentileBy, sum, sum, sumDouble, sumInt, sumLong, toList, toMap, toMap, toSet, toSet, toString, toString
collect, collect, collect, collect, collect, collect, collect, collect, collect, collect, collect, collect, collect, collect, collect
filterNot, notNull
ap1, ap2, ap3, ap4, ap5, applicatives
flatMapPublisher, flatMapPublisher, flatMapPublisher, mergePublisher, mergePublisher
patternMatch, trampoline
endsWith, print, print, printErr, printOut, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, single, singleOptional, toConcurrentLazyStreamable, validate
lazyOperations, traversable
seq, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFutureStream, toFutureStream, toFutureW, toIor, toIorSecondary, toListX, toMapX, toMaybe, toPBagX, toPMapX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toStreamable, toTry, toValue, toValueMap, toValueSet, toXor, toXorSecondary
static <T> Streamable<T> fromObject(java.lang.Object toCoerce)
static <T> Streamable<T> fromStream(java.util.stream.Stream<T> stream)
stream
- to construct Streamable fromstatic <T> Streamable<T> fromIterable(java.lang.Iterable<T> iterable)
iterable
- to construct Streamable fromstatic <T> Streamable<T> synchronizedFromStream(java.util.stream.Stream<T> toCoerce)
toCoerce
- Efficiently / lazily Makes Stream repeatable, guards iteration with locks on initial iterationstatic <T> Streamable<T> synchronizedFromIterable(java.lang.Iterable<T> toCoerce)
default org.jooq.lambda.Collectable<T> collectable()
CyclopsCollectable
collectable
in interface CyclopsCollectable<T>
collectable
in interface IterableFunctor<T>
default Streamable<T> combine(java.util.function.BiPredicate<? super T,? super T> predicate, java.util.function.BinaryOperator<T> op)
Traversable
ReactiveSeq.of(1,1,2,3)
.combine((a, b)->a.equals(b),Semigroups.intSum)
.toListX()
//ListX(3,4)
combine
in interface Traversable<T>
predicate
- Test to see if two neighbours should be joinedop
- Reducer to combine neighboursdefault <U,R> Streamable<R> zip(java.lang.Iterable<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zippable
default <U,R> Streamable<R> zip(org.jooq.lambda.Seq<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zippable
default <U,R> Streamable<R> zip(java.util.stream.Stream<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zippable
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> zip(java.util.stream.Stream<? extends U> other)
Traversable
{ @code List<Tuple2<Integer, String>> list = of(1, 2).zip(of("a", "b", "c", "d")).toList(); // [[1,"a"],[2,"b"]] }
default <S,U> Streamable<org.jooq.lambda.tuple.Tuple3<T,S,U>> zip3(java.util.stream.Stream<? extends S> second, java.util.stream.Stream<? extends U> third)
Traversable
{ @code List<Tuple3<Integer, Integer, Character>> list = of(1, 2, 3, 4, 5, 6).zip3(of(100, 200, 300, 400), of('a', 'b', 'c')).collect(Collectors.toList()); // [[1,100,'a'],[2,200,'b'],[3,300,'c']] }
zip3
in interface Traversable<T>
default <T2,T3,T4> Streamable<org.jooq.lambda.tuple.Tuple4<T,T2,T3,T4>> zip4(java.util.stream.Stream<? extends T2> second, java.util.stream.Stream<? extends T3> third, java.util.stream.Stream<? extends T4> fourth)
Traversable
{ @code List<Tuple4<Integer, Integer, Character, String>> list = of(1, 2, 3, 4, 5, 6).zip4(of(100, 200, 300, 400), of('a', 'b', 'c'), of("hello", "world")) .collect(Collectors.toList()); } // [[1,100,'a',"hello"],[2,200,'b',"world"]]
zip4
in interface Traversable<T>
default Streamable<ListX<T>> groupedStatefullyUntil(java.util.function.BiPredicate<ListX<? super T>,? super T> predicate)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedStatefullyUntil((s,i)->s.contains(4) ? true : false)
.toList().size(),equalTo(5));
groupedStatefullyUntil
in interface Traversable<T>
predicate
- Window while truedefault <K,A,D> Streamable<org.jooq.lambda.tuple.Tuple2<K,D>> grouped(java.util.function.Function<? super T,? extends K> classifier, java.util.stream.Collector<? super T,A,D> downstream)
grouped
in interface Traversable<T>
default <K> Streamable<org.jooq.lambda.tuple.Tuple2<K,org.jooq.lambda.Seq<T>>> grouped(java.util.function.Function<? super T,? extends K> classifier)
grouped
in interface Traversable<T>
default Streamable<T> takeWhile(java.util.function.Predicate<? super T> p)
takeWhile
in interface Traversable<T>
default Streamable<T> dropWhile(java.util.function.Predicate<? super T> p)
dropWhile
in interface Traversable<T>
default Streamable<T> takeUntil(java.util.function.Predicate<? super T> p)
takeUntil
in interface Traversable<T>
default Streamable<T> dropUntil(java.util.function.Predicate<? super T> p)
dropUntil
in interface Traversable<T>
default Streamable<T> dropRight(int num)
dropRight
in interface Traversable<T>
default Streamable<T> takeRight(int num)
takeRight
in interface Traversable<T>
static <T> Streamable<T> fromPublisher(org.reactivestreams.Publisher<? extends T> publisher)
publisher
- to construct ReactiveSeq fromstatic <T> Streamable<T> fromIterator(java.util.Iterator<T> it)
default <T> Streamable<T> unit(T t)
default <T> Streamable<T> unitIterator(java.util.Iterator<T> it)
IterableFunctor
ReactiveSeq<Integer> newSeq = seq.unitIterator(myIterator);
unitIterator
in interface IterableFunctor<T>
it
- Iterator to create new IterableFunctor fromstatic <T> Streamable<T> of(T... values)
values
- to construct Streamable fromstatic <T> Streamable<T> empty()
default Streamable<T> tail()
Streamable.of(1,2,3,4,5).tail()
//Streamable[2,3,4,5]
default T head()
Streamable.of(1,2,3,4,5).head()
//1
default Streamable<T> appendAll(Streamable<T> t)
Streamable.of(1,2,3).appendAll(Streamable.of(4,5,6))
//Streamable[1,2,3,4,5,6]
t
- Streamable to appenddefault Streamable<T> remove(T t)
Streamable.of(1,2,3,4,5,1,2,3).remove(1)
//Streamable[2,3,4,5,2,3]
t
- element to removedefault Streamable<T> prepend(T t)
List<String> result = Streamable.of(1,2,3)
.prepend(100,200,300)
.map(it ->it+"!!")
.collect(Collectors.toList());
assertThat(result,equalTo(Arrays.asList("100!!","200!!","300!!","1!!","2!!","3!!")));
t
- value to prependdefault Streamable<T> distinct()
distinct
in interface Traversable<T>
default <U> U foldLeft(U identity, java.util.function.BiFunction<U,? super T,U> function)
Streamable.of("hello","world")
.foldLeft("",(a,b)->a+":"+b);
//"hello:world"
identity
- - identity valuefunction
- folding functiondefault <U> U foldRight(U seed, java.util.function.BiFunction<? super T,? super U,? extends U> function)
Streamable.of("hello","world")
.foldRight("",(a,b)->a+":"+b);
//"world:hello"
default <R> Streamable<R> map(java.util.function.Function<? super T,? extends R> fn)
Streamable.of(1,2,3).map(i->i+2);
//Streamable[3,4,5]
Streamable.of(1,2,3).map(i->"hello"+(i+2));
//Streamable["hello3","hello4","hello5"]
default Streamable<T> peek(java.util.function.Consumer<? super T> fn)
Streamable.of(1,2,3)
.peek(System.out::println)
.map(i->i+2);
default Streamable<T> filter(java.util.function.Predicate<? super T> fn)
Filterable
of(1,2,3).filter(i->i>2);
//[3]
filter
in interface Filterable<T>
fn
- to filter elements by, retaining matchesdefault <R> Streamable<R> flatMap(java.util.function.Function<? super T,Streamable<? extends R>> fn)
default long count()
count
in interface org.jooq.lambda.Collectable<T>
count
in interface CyclopsCollectable<T>
default void forEachOrdered(java.util.function.Consumer<? super T> action)
default java.lang.Object[] toArray()
default <A> A[] toArray(java.util.function.IntFunction<A[]> generator)
default java.util.List<T> toList()
Streamable.of(1,2,3)
.toList();
//List[1,2,3]
toList
in interface org.jooq.lambda.Collectable<T>
toList
in interface CyclopsCollectable<T>
default <R> R collect(java.util.function.Supplier<R> supplier, java.util.function.BiConsumer<R,? super T> accumulator, java.util.function.BiConsumer<R,R> combiner)
default <R,A> R collect(java.util.stream.Collector<? super T,A,R> collector)
collect
in interface org.jooq.lambda.Collectable<T>
collect
in interface CyclopsCollectable<T>
default <C extends java.util.Collection<T>> C toCollection(java.util.function.Supplier<C> collectionFactory)
Streamable.of(1,2,3).toCollection( ()->new ArrayList());
//ArrayList[1,2,3]
toCollection
in interface org.jooq.lambda.Collectable<T>
toCollection
in interface CyclopsCollectable<T>
collectionFactory
- default Streamable<Streamable<T>> permutations()
default Streamable<T> subStream(int start, int end)
Streamable.of(1,2,3,4,5,6).subStream(1,3);
//Streamable[2,3]
start
- index inclusiveend
- index exclusivedefault T elementAt(int index)
Streamable.of(1,2,3,4,5).get(2)
//3
index
- to extract element fromdefault int size()
default Streamable<Streamable<T>> combinations(int size)
Streamable.of(1,2,3).combinations(2)
//Streamable[Streamable[1,2],Streamable[1,3],Streamable[2,3]]
size
- of combinationsdefault Streamable<Streamable<T>> combinations()
Streamable.of(1,2,3).combinations()
//Streamable[Streamable[],Streamable[1],Streamable[2],Streamable[3],Streamable[1,2],Streamable[1,3],Streamable[2,3]
,Streamable[1,2,3]]
default <T1> Streamable<T1> flatten()
Streamable.of(Arrays.asList(1,2)).flatten();
//stream of (1, 2);
default java.util.Optional<ListX<T>> toOptional()
Optional<List<String>> stream = Streamable.of("hello","world")
.toOptional();
assertThat(stream.get(),equalTo(Arrays.asList("hello","world")));
toOptional
in interface ConvertableSequence<T>
default java.util.concurrent.CompletableFuture<ListX<T>> toCompletableFuture()
CompletableFuture<List<String>> cf = Streamable.of("hello","world")
.toCompletableFuture();
assertThat(cf.join(),equalTo(Arrays.asList("hello","world")));
toCompletableFuture
in interface ConvertableSequence<T>
default Streamable<T> cycle(int times)
assertThat(Streamable.of(1,2,2)
.cycle(3)
.collect(Collectors.toList()),
equalTo(Arrays.asList(1,2,2,1,2,2,1,2,2)));
cycle
in interface Traversable<T>
times
- Times values should be repeated within a Streamdefault Streamable<T> cycle()
assertEquals(asList(1, 1, 1, 1, 1,1),Streamable.of(1).cycle().limit(6).toList());
default org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<T>> duplicate()
Tuple2<Streamable<Integer>, Streamable<Integer>> copies =of(1,2,3,4,5,6).duplicate();
assertTrue(copies.v1.anyMatch(i->i==2));
assertTrue(copies.v2.anyMatch(i->i==2));
default org.jooq.lambda.tuple.Tuple3<Streamable<T>,Streamable<T>,Streamable<T>> triplicate()
default org.jooq.lambda.tuple.Tuple4<Streamable<T>,Streamable<T>,Streamable<T>,Streamable<T>> quadruplicate()
default org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<T>> splitAt(int where)
Streamable.of(1,2,3).splitAt(1)
//Streamable[1], Streamable[2,3]
default org.jooq.lambda.tuple.Tuple2<java.util.Optional<T>,Streamable<T>> splitAtHead()
Streamable.of(1,2,3).splitAtHead()
//Tuple[1,Streamable[2,3]]
default org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<T>> splitBy(java.util.function.Predicate<T> splitter)
Streamable.of(1, 2, 3, 4, 5, 6).splitBy(i->i<4)
//Streamable[1,2,3] Streamable[4,5,6]
default org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<T>> partition(java.util.function.Predicate<T> splitter)
Streamable.of(1, 2, 3, 4, 5, 6).partition(i -> i % 2 != 0)
//Streamable[1,3,5], Streamable[2,4,6]
default Streamable<T> cycle(Monoid<T> m, int times)
List<Integer> list = AsGenericMonad,asMonad(Stream.of(1,2,2))
.cycle(Reducers.toCountInt(),3)
.collect(Collectors.toList());
//is asList(3,3,3);
cycle
in interface Traversable<T>
m
- Monoid to be used in reductiontimes
- Number of times value should be repeateddefault Streamable<T> cycleWhile(java.util.function.Predicate<? super T> predicate)
count =0;
assertThat(Streamable.of(1,2,2)
.cycleWhile(next -> count++<6)
.collect(Collectors.toList()),equalTo(Arrays.asList(1,2,2,1,2,2)));
cycleWhile
in interface Traversable<T>
predicate
- repeat while truedefault Streamable<T> cycleUntil(java.util.function.Predicate<? super T> predicate)
count =0;
assertThat(Streamable.of(1,2,2)
.cycleUntil(next -> count++>6)
.collect(Collectors.toList()),equalTo(Arrays.asList(1,2,2,1,2,2,1)));
cycleUntil
in interface Traversable<T>
predicate
- repeat while truedefault <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> zip(java.lang.Iterable<? extends U> other)
List<Tuple2<Integer, String>> list = of(1, 2).zip(of("a", "b", "c", "d")).toList();
// [[1,"a"],[2,"b"]]
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> zip(org.jooq.lambda.Seq<? extends U> other)
Zippable
default <S,U> Streamable<org.jooq.lambda.tuple.Tuple3<T,S,U>> zip3(Streamable<? extends S> second, Streamable<? extends U> third)
List<Tuple3<Integer,Integer,Character>> list =
of(1,2,3,4,5,6).zip3(of(100,200,300,400),of('a','b','c'))
.collect(Collectors.toList());
//[[1,100,'a'],[2,200,'b'],[3,300,'c']]
default <T2,T3,T4> Streamable<org.jooq.lambda.tuple.Tuple4<T,T2,T3,T4>> zip4(Streamable<? extends T2> second, Streamable<? extends T3> third, Streamable<? extends T4> fourth)
List<Tuple4<Integer,Integer,Character,String>> list =
of(1,2,3,4,5,6).zip4(of(100,200,300,400),of('a','b','c'),of("hello","world"))
.collect(Collectors.toList());
//[[1,100,'a',"hello"],[2,200,'b',"world"]]
default Streamable<org.jooq.lambda.tuple.Tuple2<T,java.lang.Long>> zipWithIndex()
assertEquals(asList(new Tuple2("a", 0L), new Tuple2("b", 1L)), of("a", "b").zipWithIndex().toList());
zipWithIndex
in interface Traversable<T>
default <S,R> Streamable<R> zipStream(java.util.stream.BaseStream<? extends S,? extends java.util.stream.BaseStream<? extends S,?>> second, java.util.function.BiFunction<? super T,? super S,? extends R> zipper)
{ @code Stream<List<Integer>> zipped = asMonad(Stream.of(1, 2, 3)).zip( Stream.of(2, 3, 4), (a, b) -> Arrays.asList(a, b)); // [[1,2][2,3][3,4]] }
second
- Stream to zip withzipper
- Zip funcitondefault Streamable<ListX<T>> sliding(int windowSize)
List<List<Integer>> list = anyM(Stream.of(1,2,3,4,5,6))
.asSequence()
.sliding(2)
.collect(Collectors.toList());
assertThat(list.get(0),hasItems(1,2));
assertThat(list.get(1),hasItems(2,3));
sliding
in interface Traversable<T>
windowSize
- Size of sliding windowdefault Streamable<ListX<T>> sliding(int windowSize, int increment)
List<List<Integer>> list = anyM(Stream.of(1,2,3,4,5,6))
.asSequence()
.sliding(3,2)
.collect(Collectors.toList());
assertThat(list.get(0),hasItems(1,2,3));
assertThat(list.get(1),hasItems(3,4,5));
sliding
in interface Traversable<T>
windowSize
- number of elements in each batchincrement
- for each windowdefault Streamable<ListX<T>> grouped(int groupSize)
{ @code List<List<Integer>> list = monad(Stream.of(1, 2, 3, 4, 5, 6)).grouped(3) .collect(Collectors.toList()); assertThat(list.get(0), hasItems(1, 2, 3)); assertThat(list.get(1), hasItems(4, 5, 6)); }
grouped
in interface Traversable<T>
groupSize
- Size of each Groupdefault <K> MapX<K,java.util.List<T>> groupBy(java.util.function.Function<? super T,? extends K> classifier)
Map<Integer, List<Integer>> map1 =of(1, 2, 3, 4).groupBy(i -> i % 2);
assertEquals(asList(2, 4), map1.get(0));
assertEquals(asList(1, 3), map1.get(1));
assertEquals(2, map1.size());
default Streamable<T> scanLeft(Monoid<T> monoid)
assertEquals(asList("", "a", "ab", "abc"),Streamable.of("a", "b", "c")
.scanLeft(Reducers.toString("")).toList());
scanLeft
in interface Traversable<T>
monoid
- To combine valuesdefault <U> Streamable<U> scanLeft(U identity, java.util.function.BiFunction<? super U,? super T,? extends U> function)
assertThat(of("a", "b", "c").scanLeft("", String::concat).toList().size(),
is(4));
scanLeft
in interface Traversable<T>
default Streamable<T> scanRight(Monoid<T> monoid)
assertThat(of("a", "b", "c").scanRight(Monoid.of("", String::concat)).toList().size(),
is(asList("", "c", "bc", "abc").size()));
scanRight
in interface Traversable<T>
default <U> Streamable<U> scanRight(U identity, java.util.function.BiFunction<? super T,? super U,? extends U> combiner)
assertThat(of("a", "ab", "abc").map(str->str.length()).scanRight(0, (t, u) -> u + t).toList().size(),
is(asList(0, 3, 5, 6).size()));
scanRight
in interface Traversable<T>
default Streamable<T> sorted()
assertThat(Streamable.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7)));
sorted
in interface Traversable<T>
default Streamable<T> sorted(java.util.Comparator<? super T> c)
assertThat(Streamable.of(4,3,6,7).sorted((a,b) -> b-a).toList(),equalTo(Arrays.asList(7,6,4,3)));
sorted
in interface Traversable<T>
c
- Compartor to sort withdefault Streamable<T> skip(long num)
assertThat(Streamable.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7)));
skip
in interface Traversable<T>
num
- Number of elemenets to skipdefault Streamable<T> skipWhile(java.util.function.Predicate<? super T> p)
assertThat(Streamable.of(4,3,6,7).sorted().skipWhile(i->i<6).toList(),equalTo(Arrays.asList(6,7)));
skipWhile
in interface Traversable<T>
p
- Predicate to skip while truedefault Streamable<T> skipUntil(java.util.function.Predicate<? super T> p)
assertThat(Streamable.of(4,3,6,7).skipUntil(i->i==6).toList(),equalTo(Arrays.asList(6,7)));
skipUntil
in interface Traversable<T>
p
- Predicate to skip until truedefault Streamable<T> limit(long num)
assertThat(Streamable.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3));
limit
in interface Traversable<T>
num
- Limit element size to numdefault Streamable<T> limitWhile(java.util.function.Predicate<? super T> p)
assertThat(Streamable.of(4,3,6,7).sorted().limitWhile(i->i<6).toList(),equalTo(Arrays.asList(3,4)));
limitWhile
in interface Traversable<T>
p
- Limit while predicate is truedefault Streamable<T> limitUntil(java.util.function.Predicate<? super T> p)
assertThat(Streamable.of(4,3,6,7).limitUntil(i->i==6).toList(),equalTo(Arrays.asList(4,3)));
limitUntil
in interface Traversable<T>
p
- Limit until predicate is truedefault boolean allMatch(java.util.function.Predicate<? super T> c)
assertThat(Streamable.of(1,2,3,4,5).allMatch(it-> it>0 && it <6),equalTo(true));
allMatch
in interface org.jooq.lambda.Collectable<T>
allMatch
in interface CyclopsCollectable<T>
c
- Predicate to check if all matchdefault boolean anyMatch(java.util.function.Predicate<? super T> c)
assertThat(Streamable.of(1,2,3,4,5).anyMatch(it-> it.equals(3)),equalTo(true));
anyMatch
in interface org.jooq.lambda.Collectable<T>
anyMatch
in interface CyclopsCollectable<T>
c
- Predicate to check if any matchdefault boolean xMatch(int num, java.util.function.Predicate<? super T> c)
assertTrue(Streamable.of(1,2,3,5,6,7).xMatch(3, i-> i>4 ));
default boolean noneMatch(java.util.function.Predicate<? super T> c)
noneMatch
in interface org.jooq.lambda.Collectable<T>
noneMatch
in interface CyclopsCollectable<T>
default java.lang.String join()
assertEquals("123".length(),Streamable.of(1, 2, 3).join().length());
default java.lang.String join(java.lang.String sep)
assertEquals("1, 2, 3".length(), Streamable.of(1, 2, 3).join(", ").length());
default java.lang.String join(java.lang.String sep, java.lang.String start, java.lang.String end)
assertEquals("^1|2|3$".length(), of(1, 2, 3).join("|", "^", "$").length());
default <C extends java.lang.Comparable<? super C>> java.util.Optional<T> minBy(java.util.function.Function<? super T,? extends C> f)
minBy
in interface org.jooq.lambda.Collectable<T>
minBy
in interface CyclopsCollectable<T>
default java.util.Optional<T> min(java.util.Comparator<? super T> comparator)
min
in interface org.jooq.lambda.Collectable<T>
min
in interface CyclopsCollectable<T>
default <C extends java.lang.Comparable<? super C>> java.util.Optional<T> maxBy(java.util.function.Function<? super T,? extends C> f)
maxBy
in interface org.jooq.lambda.Collectable<T>
maxBy
in interface CyclopsCollectable<T>
default java.util.Optional<T> max(java.util.Comparator<? super T> comparator)
max
in interface org.jooq.lambda.Collectable<T>
max
in interface CyclopsCollectable<T>
default java.util.Optional<T> findFirst()
default java.util.Optional<T> findAny()
default <R> R mapReduce(Reducer<R> reducer)
Streamable.of("hello","2","world","4").mapReduce(Reducers.toCountInt());
//4
default <R> R mapReduce(java.util.function.Function<? super T,? extends R> mapper, Monoid<R> reducer)
Streamable.of("one","two","three","four")
.mapReduce(this::toInt,Reducers.toTotalInt());
//10
int toInt(String s){
if("one".equals(s))
return 1;
if("two".equals(s))
return 2;
if("three".equals(s))
return 3;
if("four".equals(s))
return 4;
return -1;
}
default T reduce(Monoid<T> reducer)
Streamable.of("hello","2","world","4").reduce(Reducers.toString(","));
//hello,2,world,4
default <U> U reduce(U identity, java.util.function.BiFunction<U,? super T,U> accumulator, java.util.function.BinaryOperator<U> combiner)
default ListX<T> reduce(java.util.stream.Stream<? extends Monoid<T>> reducers)
Monoid<Integer> sum = Monoid.of(0,(a,b)->a+b);
Monoid<Integer> mult = Monoid.of(1,(a,b)->a*b);
List<Integer> result = Streamable.of(1,2,3,4)
.reduce(Arrays.asList(sum,mult).stream() );
assertThat(result,equalTo(Arrays.asList(10,24)));
default ListX<T> reduce(java.lang.Iterable<? extends Monoid<T>> reducers)
Monoid<Integer> sum = Monoid.of(0,(a,b)->a+b);
Monoid<Integer> mult = Monoid.of(1,(a,b)->a*b);
List<Integer> result = Streamable.of(1,2,3,4))
.reduce(Arrays.asList(sum,mult) );
assertThat(result,equalTo(Arrays.asList(10,24)));
default T foldRight(Monoid<T> reducer)
Streamable.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
default T foldRight(T identity, java.util.function.BinaryOperator<T> accumulator)
assertTrue(Streamable.of("a","b","c").foldRight("", String::concat).equals("cba"));
default <T> T foldRightMapToType(Reducer<T> reducer)
Streamable.of(1,2,3).foldRightMapToType(Reducers.toString(""));
// "321"
foldRightMapToType
in interface Foldable<T>
reducer
- Monoid to reduce valuesdefault boolean startsWithIterable(java.lang.Iterable<T> iterable)
assertTrue(Streamable.of(1,2,3,4).startsWith(Arrays.asList(1,2,3)));
startsWithIterable
in interface Foldable<T>
iterable
- default boolean startsWith(java.util.stream.Stream<T> iterator)
assertTrue(Streamable.of(1,2,3,4).startsWith(Stream.of(1,2,3)))
startsWith
in interface Foldable<T>
iterator
- default <R> Streamable<R> flatMapAnyM(java.util.function.Function<? super T,AnyM<? extends R>> fn)
assertThat(Streamable.of(1,2,3)).flatMapAnyM(i-> anyM(CompletableFuture.completedFuture(i+2))).toList(),equalTo(Arrays.asList(3,4,5)));
fn
- to be applieddefault <R> Streamable<R> flatMapIterable(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> fn)
Streamable.of(1,2)
.flatMap(i -> asList(i, -i))
.toList();
//1,-1,2,-2
fn
- default <R> Streamable<R> flatMapStream(java.util.function.Function<? super T,java.util.stream.BaseStream<? extends R,?>> fn)
assertThat(Streamable.of(1,2,3)
.flatMapStream(i->IntStream.of(i))
.toList(),equalTo(Arrays.asList(1,2,3)));
fn
- to be applieddefault Streamable<T> intersperse(T value)
intersperse
in interface Traversable<T>
default <U> Streamable<U> ofType(java.lang.Class<? extends U> type)
ofType
in interface Filterable<T>
default <U> Streamable<U> cast(java.lang.Class<? extends U> type)
ClassCastException
.
// ClassCastException Streamable.of(1, "a", 2, "b", 3).cast(Integer.class)default CollectionX<T> toLazyCollection()
Collection<Integer> col = Streamable.of(1,2,3,4,5)
.peek(System.out::println)
.toLazyCollection();
System.out.println("first!");
col.forEach(System.out::println);
//Will print out "first!" before anything else
toLazyCollection
in interface Foldable<T>
default CollectionX<T> toConcurrentLazyCollection()
Collection<Integer> col = Streamable.of(1,2,3,4,5)
.peek(System.out::println)
.toConcurrentLazyCollection();
System.out.println("first!");
col.forEach(System.out::println);
//Will print out "first!" before anything else
toConcurrentLazyCollection
in interface Foldable<T>
default Streamable<T> reverse()
reverse
in interface Traversable<T>
default Streamable<T> shuffle()
shuffle
in interface Traversable<T>
default Streamable<T> appendStreamable(Streamable<T> stream)
List<String> result = Streamable.of(1,2,3)
.appendStream(Streamable.of(100,200,300))
.map(it ->it+"!!")
.collect(Collectors.toList());
assertThat(result,equalTo(Arrays.asList("1!!","2!!","3!!","100!!","200!!","300!!")));
stream
- to appenddefault Streamable<T> prependStreamable(Streamable<T> stream)
List<String> result = Streamable.of(1,2,3)
.prependStream(of(100,200,300))
.map(it ->it+"!!")
.collect(Collectors.toList());
assertThat(result,equalTo(Arrays.asList("100!!","200!!","300!!","1!!","2!!","3!!")));
stream
- to Prependdefault Streamable<T> append(T... values)
List<String> result = Streamable.of(1,2,3)
.append(100,200,300)
.map(it ->it+"!!")
.collect(Collectors.toList());
assertThat(result,equalTo(Arrays.asList("1!!","2!!","3!!","100!!","200!!","300!!")));
values
- to appenddefault Streamable<T> prepend(T... values)
List<String> result = Streamable.of(1,2,3)
.prepend(100,200,300)
.map(it ->it+"!!")
.collect(Collectors.toList());
assertThat(result,equalTo(Arrays.asList("100!!","200!!","300!!","1!!","2!!","3!!")));
values
- to prependdefault Streamable<T> insertAt(int pos, T... values)
List<String> result = Streamable.of(1,2,3)
.insertAt(1,100,200,300)
.map(it ->it+"!!")
.collect(Collectors.toList());
assertThat(result,equalTo(Arrays.asList("1!!","100!!","200!!","300!!","2!!","3!!")));
pos
- to insert data atvalues
- to insertdefault Streamable<T> deleteBetween(int start, int end)
List<String> result = Streamable.of(1,2,3,4,5,6)
.deleteBetween(2,4)
.map(it ->it+"!!")
.collect(Collectors.toList());
assertThat(result,equalTo(Arrays.asList("1!!","2!!","5!!","6!!")));
start
- indexend
- indexdefault Streamable<T> insertStreamableAt(int pos, Streamable<T> stream)
List<String> result = Streamable.of(1,2,3)
.insertStreamAt(1,of(100,200,300))
.map(it ->it+"!!")
.collect(Collectors.toList());
assertThat(result,equalTo(Arrays.asList("1!!","100!!","200!!","300!!","2!!","3!!")));
pos
- to insert Stream atstream
- to insertdefault FutureOperations<T> futureOperations(java.util.concurrent.Executor exec)
futureOperations
in interface Traversable<T>
exec
- Executor to use for Stream executiondefault boolean endsWithIterable(java.lang.Iterable<T> iterable)
assertTrue(Streamable.of(1,2,3,4,5,6)
.endsWith(Arrays.asList(5,6)));
endsWithIterable
in interface Foldable<T>
iterable
- Values to checkdefault boolean endsWith(Streamable<T> stream)
assertTrue(Streamable.of(1,2,3,4,5,6)
.endsWith(Stream.of(5,6)));
stream
- Values to checkdefault Streamable<T> skip(long time, java.util.concurrent.TimeUnit unit)
List<Integer> result = Streamable.of(1,2,3,4,5,6)
.peek(i->sleep(i*100))
.skip(1000,TimeUnit.MILLISECONDS)
.toList();
//[4,5,6]
time
- Length of timeunit
- Time unitdefault Streamable<T> limit(long time, java.util.concurrent.TimeUnit unit)
List<Integer> result = Streamable.of(1,2,3,4,5,6)
.peek(i->sleep(i*100))
.limit(1000,TimeUnit.MILLISECONDS)
.toList();
//[1,2,3,4]
time
- Length of timeunit
- Time unitdefault Streamable<T> skipLast(int num)
skipLast
in interface Traversable<T>
num
- default Streamable<T> limitLast(int num)
assertThat(Streamable.of(1,2,3,4,5)
.limitLast(2)
.collect(Collectors.toList()),equalTo(Arrays.asList(4,5)));
limitLast
in interface Traversable<T>
num
- of elements to return (last elements)default HotStream<T> hotStream(java.util.concurrent.Executor e)
HotStream<Integer> ints = Streamable.range(0,Integer.MAX_VALUE)
.hotStream(exec)
ints.connect().forEach(System.out::println);
//print out all the ints
//multiple consumers are possible, so other Streams can connect on different Threads
e
- Executor to execute this Streamable ondefault T firstValue()
assertThat(Streamable.of(1,2,3,4)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
firstValue
in interface Foldable<T>
default T single()
assertThat(Streamable.of(1).single(),equalTo(1));
default java.util.Optional<T> get(long index)
assertThat(Streamable.of(1,2,3,4,5).elementAt(2).get(),equalTo(3));
default org.jooq.lambda.tuple.Tuple2<T,Streamable<T>> elementAt(long index)
Streamable.of(1,2,3,4,5).get(2).v1
//3
index
- to extract element fromdefault Streamable<org.jooq.lambda.tuple.Tuple2<T,java.lang.Long>> elapsed()
Streamable.of(1,2,3,4,5)
.elapsed()
.forEach(System.out::println);
default Streamable<org.jooq.lambda.tuple.Tuple2<T,java.lang.Long>> timestamp()
Streamable.of(1,2,3,4,5)
.timestamp()
.forEach(System.out::println)
static <T> Streamable<T> reversedOf(T... elements)
elements
- To Construct sequence fromstatic <T> Streamable<T> reversedListOf(java.util.List<T> elements)
elements
- To Construct sequence fromstatic Streamable<java.lang.Integer> range(int start, int end)
start
- Number of range to start fromend
- Number for range to end atstatic Streamable<java.lang.Long> rangeLong(long start, long end)
start
- Number of range to start fromend
- Number for range to end atstatic Streamable<java.lang.Integer> fromIntStream(java.util.stream.IntStream stream)
stream
- Stream to construct Sequence fromstatic Streamable<java.lang.Long> fromLongStream(java.util.stream.LongStream stream)
stream
- Stream to construct Sequence fromstatic Streamable<java.lang.Double> fromDoubleStream(java.util.stream.DoubleStream stream)
stream
- Stream to construct Sequence fromstatic <T> Streamable<T> fromList(java.util.List<T> list)
static <T> Streamable<T> iterate(T seed, java.util.function.UnaryOperator<T> f)
Stream.iterate(Object, UnaryOperator)
static <T> Streamable<T> generate(java.util.function.Supplier<T> s)
Stream.generate(Supplier)
static <T,U> org.jooq.lambda.tuple.Tuple2<Streamable<T>,Streamable<U>> unzip(Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> sequence)
unzip(Streamable.of(new Tuple2(1, "a"), new Tuple2(2, "b"), new Tuple2(3, "c")))
// Streamable[1,2,3], Streamable[a,b,c]
static <T1,T2,T3> org.jooq.lambda.tuple.Tuple3<Streamable<T1>,Streamable<T2>,Streamable<T3>> unzip3(Streamable<org.jooq.lambda.tuple.Tuple3<T1,T2,T3>> sequence)
unzip3(Streamable.of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3,"c", 4l)))
// Streamable[1,2,3], Streamable[a,b,c], Streamable[2l,3l,4l]
static <T1,T2,T3,T4> org.jooq.lambda.tuple.Tuple4<Streamable<T1>,Streamable<T2>,Streamable<T3>,Streamable<T4>> unzip4(Streamable<org.jooq.lambda.tuple.Tuple4<T1,T2,T3,T4>> sequence)
unzip4(Streamable.of(new Tuple4(1, "a", 2l,'z'), new Tuple4(2, "b", 3l,'y'), new Tuple4(3,
"c", 4l,'x')));
// Streamable[1,2,3], Streamable[a,b,c], Streamable[2l,3l,4l], Streamable[z,y,x]
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> crossJoin(Streamable<U> other)
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> innerJoin(Streamable<U> other, java.util.function.BiPredicate<T,U> predicate)
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> leftOuterJoin(Streamable<U> other, java.util.function.BiPredicate<T,U> predicate)
default <U> Streamable<org.jooq.lambda.tuple.Tuple2<T,U>> rightOuterJoin(Streamable<U> other, java.util.function.BiPredicate<T,U> predicate)
default Streamable<T> onEmptySwitch(java.util.function.Supplier<Streamable<T>> switchTo)
assertThat(Streamable.of(4,5,6)
.onEmptySwitch(()->Streamable.of(1,2,3))
.toList(),
equalTo(Arrays.asList(4,5,6)));
switchTo
- Supplier that will generate the alternative Streamdefault Streamable<T> onEmpty(T value)
OnEmpty
default Streamable<T> onEmptyGet(java.util.function.Supplier<? extends T> supplier)
OnEmpty
onEmptyGet
in interface OnEmpty<T>
onEmptyGet
in interface Traversable<T>
supplier
- to determine new value for containerdefault <X extends java.lang.Throwable> Streamable<T> onEmptyThrow(java.util.function.Supplier<? extends X> supplier)
OnEmpty
onEmptyThrow
in interface OnEmpty<T>
onEmptyThrow
in interface Traversable<T>
supplier
- to create exception fromdefault Streamable<T> concat(Streamable<T> other)
default Streamable<T> concat(T other)
default Streamable<T> concat(T... other)
default <U> Streamable<T> distinct(java.util.function.Function<? super T,? extends U> keyExtractor)
default Streamable<T> shuffle(java.util.Random random)
shuffle
in interface Traversable<T>
default Streamable<T> slice(long from, long to)
slice
in interface Traversable<T>
default <U extends java.lang.Comparable<? super U>> Streamable<T> sorted(java.util.function.Function<? super T,? extends U> function)
sorted
in interface Traversable<T>
default Streamable<T> xPer(int x, long time, java.util.concurrent.TimeUnit t)
SimpleTimer timer = new SimpleTimer();
assertThat(Streamable.of(1,2,3,4,5,6)
.xPer(6,100000000,TimeUnit.NANOSECONDS)
.collect(Collectors.toList()).size(),is(6));
x
- number of elements to emittime
- periodt
- Time unitdefault Streamable<T> onePer(long time, java.util.concurrent.TimeUnit t)
Streamable.iterate("", last -> "next")
.limit(100)
.batchBySize(10)
.onePer(1, TimeUnit.MICROSECONDS)
.peek(batch -> System.out.println("batched : " + batch))
.flatMap(Collection::stream)
.peek(individual -> System.out.println("Flattened : "
+ individual))
.forEach(a->{});
time
- periodt
- Time unitdefault Streamable<T> debounce(long time, java.util.concurrent.TimeUnit t)
Streamable.of(1,2,3,4,5,6)
.debounce(1000,TimeUnit.SECONDS).toList();
// 1
time
- t
- default Streamable<ListX<T>> groupedBySizeAndTime(int size, long time, java.util.concurrent.TimeUnit t)
Streamable.of(1,2,3,4,5,6)
.batchBySizeAndTime(3,10,TimeUnit.SECONDS)
.toList();
//[[1,2,3],[4,5,6]]
size
- Max size of a batchtime
- (Max) time period to build a single batch int
- time unit for batchdefault <C extends java.util.Collection<? super T>> Streamable<C> groupedBySizeAndTime(int size, long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory)
List<ArrayList<Integer>> list = of(1,2,3,4,5,6)
.batchBySizeAndTime(10,1,TimeUnit.MICROSECONDS,()->new ArrayList<>())
.toList();
size
- Max size of a batchtime
- (Max) time period to build a single batch inunit
- time unit for batchfactory
- Collection factorydefault Streamable<ListX<T>> groupedByTime(long time, java.util.concurrent.TimeUnit t)
assertThat(Streamable.of(1,2,3,4,5,6).batchByTime(1,TimeUnit.SECONDS).collect(Collectors.toList()).size(),is(1));
assertThat(Streamable.of(1,2,3,4,5,6).batchByTime(1,TimeUnit.NANOSECONDS).collect(Collectors.toList()).size(),greaterThan(5));
time
- - time period to build a single batch int
- time unit for batchdefault <C extends java.util.Collection<? super T>> Streamable<C> groupedByTime(long time, java.util.concurrent.TimeUnit unit, java.util.function.Supplier<C> factory)
assertThat(Streamable.of(1,1,1,1,1,1)
.batchByTime(1500,TimeUnit.MICROSECONDS,()-> new TreeSet<>())
.toList()
.get(0)
.size(),is(1));
time
- - time period to build a single batch inunit
- time unit for batchfactory
- Collection factorydefault <C extends java.util.Collection<? super T>> Streamable<C> grouped(int size, java.util.function.Supplier<C> supplier)
assertThat(Streamable.of(1,1,1,1,1,1)
.batchBySize(3,()->new TreeSet<>())
.toList()
.get(0)
.size(),is(1));
grouped
in interface Traversable<T>
size
- batch sizesupplier
- Collection factorydefault Streamable<T> fixedDelay(long l, java.util.concurrent.TimeUnit unit)
SimpleTimer timer = new SimpleTimer();
assertThat(Streamable.of(1,2,3,4,5,6)
.fixedDelay(10000,TimeUnit.NANOSECONDS)
.collect(Collectors.toList())
.size(),is(6));
assertThat(timer.getElapsedNanoseconds(),greaterThan(60000l));
l
- time length in nanos of the delayunit
- for the delaydefault Streamable<T> jitter(long maxJitterPeriodInNanos)
SimpleTimer timer = new SimpleTimer();
assertThat(Streamable.of(1,2,3,4,5,6)
.jitter(10000)
.collect(Collectors.toList())
.size(),is(6));
assertThat(timer.getElapsedNanoseconds(),greaterThan(20000l));
maxJitterPeriodInNanos
- - random number less than this is used for each jitterdefault Streamable<ListX<T>> groupedUntil(java.util.function.Predicate<? super T> predicate)
assertThat(Streamable.of(1,2,3,4,5,6)
.batchUntil(i->i%3==0)
.toList()
.size(),equalTo(2));
groupedUntil
in interface Traversable<T>
predicate
- Batch until predicate holds, then open next batchdefault Streamable<ListX<T>> groupedWhile(java.util.function.Predicate<? super T> predicate)
assertThat(Streamable.of(1,2,3,4,5,6)
.batchWhile(i->i%3!=0)
.toList().size(),equalTo(2));
groupedWhile
in interface Traversable<T>
predicate
- Batch while predicate holds, then open next batchdefault <C extends java.util.Collection<? super T>> Streamable<C> groupedWhile(java.util.function.Predicate<? super T> predicate, java.util.function.Supplier<C> factory)
assertThat(Streamable.of(1,2,3,4,5,6)
.batchWhile(i->i%3!=0)
.toList()
.size(),equalTo(2));
groupedWhile
in interface Traversable<T>
predicate
- Batch while predicate holds, then open next batchfactory
- Collection factorydefault <C extends java.util.Collection<? super T>> Streamable<C> groupedUntil(java.util.function.Predicate<? super T> predicate, java.util.function.Supplier<C> factory)
assertThat(Streamable.of(1,2,3,4,5,6)
.batchUntil(i->i%3!=0)
.toList()
.size(),equalTo(2));
groupedUntil
in interface Traversable<T>
predicate
- Batch until predicate holds, then open next batchfactory
- Collection factorydefault Streamable<T> recover(java.util.function.Function<java.lang.Throwable,? extends T> fn)
assertThat(Streamable.of(1,2,3,4)
.map(i->i+2)
.map(u->{throw new RuntimeException();})
.recover(e->"hello")
.firstValue(),equalTo("hello"));
fn
- Function that accepts a Throwable and returns an alternative valuedefault <EX extends java.lang.Throwable> Streamable<T> recover(java.lang.Class<EX> exceptionClass, java.util.function.Function<EX,T> fn)
assertThat(Streamable.of(1,2,3,4)
.map(i->i+2)
.map(u->{ExceptionSoftener.throwSoftenedException( new IOException()); return null;})
.recover(IOException.class,e->"hello")
.firstValue(),equalTo("hello"));
exceptionClass
- Type to recover fromfn
- That accepts an error and returns an alternative valuedefault <R> Streamable<R> retry(java.util.function.Function<T,R> fn)
given(serviceMock.apply(anyInt())).willThrow(
new RuntimeException(new SocketException("First")),
new RuntimeException(new IOException("Second"))).willReturn(
"42");
String result = Streamable.of( 1, 2, 3)
.retry(serviceMock)
.firstValue();
assertThat(result, is("42"));
fn
- Function to retry if failsdefault boolean contains(T t)
assertThat(Streamable.of(1,2,3,4,5).contains(3),equalTo(true));
t
- element to check fordefault ReactiveSeq<T> stream()
stream
in interface ConvertableSequence<T>
stream
in interface Foldable<T>
stream
in interface IterableFunctor<T>
stream
in interface ToStream<T>
stream
in interface Traversable<T>