public interface LazySeq<T> extends ImmutableList<T>, Folds<T>, Filters<T>, Transformable<T>, java.io.Serializable, Higher<DataWitness.lazySeq,T>
Modifier and Type | Interface and Description |
---|---|
static class |
LazySeq.Cons<T> |
static class |
LazySeq.Nil<T> |
ImmutableList.None<T>, ImmutableList.Some<T>
Modifier and Type | Method and Description |
---|---|
LazySeq<T> |
append(java.util.function.Supplier<LazySeq<T>> list) |
default LazySeq<T> |
append(T append) |
default LazySeq<T> |
appendAll(java.lang.Iterable<? extends T> it) |
default LazySeq<T> |
appendAll(T... values)
Append values to the take of this ReactiveSeq
|
static <T> java.util.stream.Collector<T,java.util.List<T>,LazySeq<T>> |
collector() |
default LazySeq<ReactiveSeq<T>> |
combinations() |
default LazySeq<ReactiveSeq<T>> |
combinations(int size) |
default LazySeq<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 and reduction operation.
|
default LazySeq<T> |
combine(Monoid<T> op,
java.util.function.BiPredicate<? super T,? super T> predicate)
Combine two adjacent elements in a traversable using the supplied BinaryOperator
This is a stateful grouping and reduction operation.
|
<R> LazySeq<R> |
concatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> fn)
Perform a flatMap operation on this IterableX.
|
static <T> LazySeq<T> |
cons(T head,
java.util.function.Supplier<LazySeq<T>> tail) |
default boolean |
containsValue(T value) |
LazySeq<T> |
cycle() |
default LazySeq<T> |
cycle(long times)
Convert to a Stream with the values repeated specified times
|
default LazySeq<T> |
cycle(Monoid<T> m,
long times)
Convert to a Stream with the result of a reduction operation repeated
specified times
|
default LazySeq<T> |
cycleUntil(java.util.function.Predicate<? super T> predicate)
Repeat in a Stream until specified predicate holds
|
default LazySeq<T> |
cycleWhile(java.util.function.Predicate<? super T> predicate)
Repeat in a Stream while specified predicate holds
|
static <T> LazySeq<T> |
deferred(java.util.function.Supplier<? extends java.lang.Iterable<? extends T>> lazy) |
default LazySeq<T> |
deleteBetween(int start,
int end)
Delete elements between given indexes in a Stream
|
default LazySeq<T> |
distinct() |
default LazySeq<T> |
drop(long num)
assertThat(ReactiveSeq.of(4,3,6,7).drop(2).toList(),equalTo(Arrays.asList(6,7))); |
default LazySeq<T> |
dropRight(int num)
Generate a new Traversable that drops the specified number elements from the take of this Traversable
|
default LazySeq<T> |
dropUntil(java.util.function.Predicate<? super T> p)
Generate a new Traversable that drops elements from this Traversable until the predicate holds
|
default LazySeq<T> |
dropWhile(java.util.function.Predicate<? super T> p)
Generate a new Traversable that drops elements from this Traversable as long as the predicate holds
|
default Tuple2<LazySeq<T>,LazySeq<T>> |
duplicate() |
static <T> LazySeq<T> |
empty() |
default ImmutableList<T> |
emptyUnit() |
static <E extends java.lang.Enum<E>> |
enums(java.lang.Class<E> c)
Stream over the values of an enum
|
static <E extends java.lang.Enum<E>> |
enums(java.lang.Class<E> c,
E start)
Stream over the values of an enum
|
static <E extends java.lang.Enum<E>> |
enums(java.lang.Class<E> c,
E start,
E step,
E end)
Stream over the values of an enum
|
static <E extends java.lang.Enum<E>> |
enumsFromTo(java.lang.Class<E> c,
E start,
E end)
Stream over the values of an enum
|
static <T> LazySeq<T> |
fill(long limit,
T t) |
static <T> LazySeq<T> |
fill(T t) |
LazySeq<T> |
filter(java.util.function.Predicate<? super T> pred)
Keep only elements for which the supplied predicates hold
e.g.
|
default LazySeq<T> |
filterNot(java.util.function.Predicate<? super T> predicate)
Remove any elements for which the predicate holds (inverse operation to filter)
e.g.
|
<R> LazySeq<R> |
flatMap(java.util.function.Function<? super T,? extends ImmutableList<? extends R>> fn) |
<R> R |
foldLazySeq(java.util.function.Function<? super LazySeq.Cons<T>,? extends R> fn1,
java.util.function.Function<? super LazySeq.Nil,? extends R> fn2) |
default <R> R |
foldLeft(R zero,
java.util.function.BiFunction<R,? super T,R> f) |
default T |
foldRight(Monoid<T> reducer)
ReactiveSeq.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
|
default <R> R |
foldRight(R zero,
java.util.function.BiFunction<? super T,? super R,? extends R> f)
Immutable reduction from right to left
|
default T |
foldRight(T identity,
java.util.function.BinaryOperator<T> accumulator)
Immutable reduction from right to left
|
default <R1,R> LazySeq<R> |
forEach2(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction) |
default <R1,R> LazySeq<R> |
forEach2(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,java.lang.Boolean> filterFunction,
java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction) |
default <R1,R2,R> LazySeq<R> |
forEach3(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2,
Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction) |
default <R1,R2,R> LazySeq<R> |
forEach3(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2,
Function3<? super T,? super R1,? super R2,java.lang.Boolean> filterFunction,
Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction) |
default <R1,R2,R3,R> |
forEach4(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2,
Function3<? super T,? super R1,? super R2,? extends java.lang.Iterable<R3>> iterable3,
Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction) |
default <R1,R2,R3,R> |
forEach4(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2,
Function3<? super T,? super R1,? super R2,? extends java.lang.Iterable<R3>> iterable3,
Function4<? super T,? super R1,? super R2,? super R3,java.lang.Boolean> filterFunction,
Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction) |
static <T> LazySeq<T> |
fromIterable(java.lang.Iterable<T> it) |
static <T> LazySeq<T> |
fromIterator(java.util.Iterator<T> it) |
static <T> LazySeq<T> |
fromStream(java.util.stream.Stream<T> stream) |
static <T> LazySeq<T> |
generate(Generator<T> s) |
static <T> LazySeq<T> |
generate(java.util.function.Supplier<T> s) |
static <T> LazySeq<T> |
generate(java.util.function.Supplier<T> s,
long times) |
default Option<T> |
get(int pos) |
default T |
getOrElse(int pos,
T alt) |
default T |
getOrElseGet(int pos,
java.util.function.Supplier<? extends T> alt) |
default LazySeq<Vector<T>> |
grouped(int groupSize)
Group elements in a Stream
|
default <C extends PersistentCollection<? super T>> |
grouped(int size,
java.util.function.Supplier<C> supplier)
Batch elements in a Stream by size into a toX created by the
supplied factory
|
default LazySeq<Vector<T>> |
groupedUntil(java.util.function.BiPredicate<Vector<? super T>,? super T> predicate)
Create Travesable of Lists where
each List is populated while the supplied bipredicate holds.
|
default LazySeq<Vector<T>> |
groupedUntil(java.util.function.Predicate<? super T> predicate)
Create a Traversable batched by List, where each batch is populated until
the predicate holds
|
default <C extends PersistentCollection<? super T>> |
groupedUntil(java.util.function.Predicate<? super T> predicate,
java.util.function.Supplier<C> factory)
Create a ReactiveSeq batched by a Collection, where each batch is populated
until the predicate holds
|
default LazySeq<Vector<T>> |
groupedWhile(java.util.function.Predicate<? super T> predicate)
Create a Traversable batched by List, where each batch is populated while
the predicate holds
|
default <C extends PersistentCollection<? super T>> |
groupedWhile(java.util.function.Predicate<? super T> predicate,
java.util.function.Supplier<C> factory)
Create a SequenceM batched by a Collection, where each batch is populated
while the predicate holds
|
default T |
headOrElse(T head) |
default T |
headOrElseGet(java.util.function.Supplier<? extends T> head) |
default LazySeq<T> |
insertAt(int pos,
java.lang.Iterable<? extends T> list) |
default LazySeq<T> |
insertAt(int pos,
T... values)
Insert data into a stream at given position
|
default LazySeq<T> |
insertAt(int i,
T e) |
default LazySeq<T> |
insertStreamAt(int pos,
java.util.stream.Stream<T> stream)
Insert a Stream into the middle of this stream at the specified position
|
default LazySeq<T> |
intersperse(T value)
Returns a stream with a given value interspersed between any two values
of this stream.
|
boolean |
isEmpty() |
static <T> LazySeq<T> |
iterate(T seed,
java.util.function.Predicate<? super T> pred,
java.util.function.UnaryOperator<T> f) |
static <T> LazySeq<T> |
iterate(T seed,
java.util.function.UnaryOperator<T> f) |
static <T> LazySeq<T> |
iterate(T seed,
java.util.function.UnaryOperator<T> f,
long times) |
default java.util.Iterator<T> |
iterator() |
static <T> LazySeq<T> |
lazy(T head,
java.util.function.Supplier<ImmutableList<T>> tail) |
<R> R |
lazyFoldRight(R zero,
java.util.function.BiFunction<? super T,java.util.function.Supplier<R>,? extends R> f) |
default LazySeq<T> |
limit(long num)
assertThat(ReactiveSeq.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3)); |
default LazySeq<T> |
limitLast(int num)
Limit results to the last x elements in a SequenceM
|
default LazySeq<T> |
limitUntil(java.util.function.Predicate<? super T> p)
Take elements from the Stream until the predicate returns true, after
which all elements are excluded.
|
default LazySeq<T> |
limitWhile(java.util.function.Predicate<? super T> p)
Take elements from the Stream while the predicate holds, once the
predicate returns false all subsequent elements are excluded
|
default LazySeq<T> |
linkedSeq() |
<R> LazySeq<R> |
map(java.util.function.Function<? super T,? extends R> fn)
Transform this functor using the supplied transformation function
|
<R> LazySeq<R> |
mergeMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn) |
<R> LazySeq<R> |
mergeMap(int maxConcurecy,
java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn) |
default java.lang.String |
mkString() |
static <R> LazySeq<R> |
narrow(LazySeq<? extends R> rs) |
static <T> LazySeq<T> |
narrowK(Higher<DataWitness.lazySeq,T> list) |
default LazySeq<T> |
notNull()
Filter elements retaining only values which are not null
|
static <T> LazySeq<T> |
of(T... value) |
default <U> LazySeq<U> |
ofType(java.lang.Class<? extends U> type)
Keep only those elements in a stream that are of a given type.
|
LazySeq<T> |
onEmpty(T value)
If this Container instance is zero, create a new instance containing the provided value
|
LazySeq<T> |
onEmptyGet(java.util.function.Supplier<? extends T> supplier)
If this Container instance is zero, create a new instance containing the value returned from the provided Supplier
|
ImmutableList<T> |
onEmptySwitch(java.util.function.Supplier<? extends ImmutableList<T>> supplier)
Switch to container created by provided Supplier, if current Container zero
|
default LazySeq<T> |
peek(java.util.function.Consumer<? super T> c)
Peek at the current value of this Transformable, without transforming it
|
default LazySeq<ReactiveSeq<T>> |
permutations() |
default LazySeq<T> |
plus(T value) |
default LazySeq<T> |
plusAll(java.lang.Iterable<? extends T> t) |
default LazySeq<T> |
prepend(T value) |
default LazySeq<T> |
prependAll(java.lang.Iterable<? extends T> it) |
default LazySeq<T> |
prependAll(T... values)
Prepend given values to the skip of the Stream
|
default LazySeq<T> |
prependStream(java.util.stream.Stream<? extends T> stream)
Prepend Stream to this ReactiveSeq
|
static LazySeq<java.lang.Integer> |
range(int start,
int end) |
static LazySeq<java.lang.Integer> |
range(int start,
int step,
int end) |
static LazySeq<java.lang.Long> |
rangeLong(long start,
long end) |
static LazySeq<java.lang.Long> |
rangeLong(long start,
long step,
long end) |
default LazySeq<T> |
removeAll(java.lang.Iterable<? extends T> list)
Remove all elements in the supplied Iterable from this filterable
|
default LazySeq<T> |
removeAll(T... values)
Remove all supplied elements from this filterable
|
LazySeq<T> |
removeAt(int i) |
default LazySeq<T> |
removeAt(long pos) |
default LazySeq<T> |
removeFirst(java.util.function.Predicate<? super T> pred) |
default LazySeq<T> |
removeStream(java.util.stream.Stream<? extends T> stream)
Remove all elements in the supplied Stream from this filterable
|
default LazySeq<T> |
removeValue(T value) |
default LazySeq<T> |
replaceFirst(T currentElement,
T newElement) |
default LazySeq<T> |
retainAll(java.lang.Iterable<? extends T> it)
Retain only the supplied elements in the returned Filters
|
default LazySeq<T> |
retainAll(T... values)
Retain only the supplied elements in the returned Filters
|
default LazySeq<T> |
retainStream(java.util.stream.Stream<? extends T> stream)
Retain only the supplied elements in the returned Filters
|
default LazySeq<T> |
reverse()
Potentially efficient Stream reversal.
|
default LazySeq<T> |
scanLeft(Monoid<T> monoid)
Scan left using supplied Monoid
|
default <U> LazySeq<U> |
scanLeft(U seed,
java.util.function.BiFunction<? super U,? super T,? extends U> function)
Scan left
|
default LazySeq<T> |
scanRight(Monoid<T> monoid)
Scan right
|
default <U> LazySeq<U> |
scanRight(U identity,
java.util.function.BiFunction<? super T,? super U,? extends U> combiner)
Scan right
|
default LazySeq<T> |
shuffle() |
default LazySeq<T> |
shuffle(java.util.Random random) |
int |
size() |
default LazySeq<T> |
skip(long num)
assertThat(ReactiveSeq.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7))); |
default LazySeq<T> |
skipLast(int num)
assertThat(ReactiveSeq.of(1,2,3,4,5) .skipLast(2)
.collect(CyclopsCollectors.toList()),equalTo(Arrays.asList(1,2,3)));
|
default LazySeq<T> |
skipUntil(java.util.function.Predicate<? super T> p)
Drop elements from the Stream until the predicate returns true, after
which all elements are included
|
default LazySeq<T> |
skipWhile(java.util.function.Predicate<? super T> p)
SkipWhile drops elements from the Stream while the predicate holds, once
the predicte returns true all subsequent elements are included *
|
default LazySeq<T> |
slice(long from,
long to) |
default LazySeq<Seq<T>> |
sliding(int windowSize)
Create a sliding view over this Sequence
|
default LazySeq<Seq<T>> |
sliding(int windowSize,
int increment)
Create a sliding view over this Sequence
|
default LazySeq<T> |
sorted()
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7))); |
default LazySeq<T> |
sorted(java.util.Comparator<? super T> c)
assertThat(ReactiveSeq.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 Tuple2<ImmutableList<T>,ImmutableList<T>> |
span(java.util.function.Predicate<? super T> pred) |
default LazySeq<LazySeq<T>> |
split(java.util.function.Predicate<? super T> test) |
default Tuple2<ImmutableList<T>,ImmutableList<T>> |
splitBy(java.util.function.Predicate<? super T> test) |
default ReactiveSeq<T> |
stream() |
default LazySeq<T> |
subList(int start,
int end) |
default LazySeq<T> |
tailOrElse(LazySeq<T> tail) |
default LazySeq<T> |
tailOrElseGet(java.util.function.Supplier<? extends LazySeq<T>> tail) |
static <T,R> LazySeq<R> |
tailRec(T initial,
java.util.function.Function<? super T,? extends LazySeq<? extends Either<T,R>>> fn) |
default LazySeq<T> |
take(long n)
assertThat(ReactiveSeq.of(4,3,6,7).take(2).toList(),equalTo(Arrays.asList(4,3)); |
default LazySeq<T> |
takeRight(int num)
Generate a new Traversable that takes the specified number elements from the take of this Traversable
|
default LazySeq<T> |
takeUntil(java.util.function.Predicate<? super T> p)
Generate a new Traversable that takes elements from this Traversable until the predicate holds
|
default LazySeq<T> |
takeWhile(java.util.function.Predicate<? super T> p)
Generate a new Traversable that takes elements from this Traversable as long as the predicate holds
|
static <U,T> LazySeq<T> |
unfold(U seed,
java.util.function.Function<? super U,Option<Tuple2<T,U>>> unfolder) |
default <R> LazySeq<R> |
unitIterable(java.lang.Iterable<R> it)
Create an IterableFunctor instance of the same type from an Iterator
|
default <R> LazySeq<R> |
unitStream(java.util.stream.Stream<R> stream) |
default <R1,R2> Tuple2<LazySeq<R1>,LazySeq<R2>> |
unzip(java.util.function.Function<? super T,Tuple2<? extends R1,? extends R2>> fn) |
static <T,U> Tuple2<LazySeq<T>,LazySeq<U>> |
unzip(LazySeq<Tuple2<T,U>> sequence) |
LazySeq<T> |
updateAt(int i,
T value) |
static <T> Higher<DataWitness.lazySeq,T> |
widen(LazySeq<T> narrow) |
static <C2,T> Higher<C2,Higher<DataWitness.lazySeq,T>> |
widen2(Higher<C2,LazySeq<T>> list) |
default <T2,R> LazySeq<R> |
zip(java.util.function.BiFunction<? super T,? super T2,? extends R> fn,
org.reactivestreams.Publisher<? extends T2> publisher)
Zip (combine) this Zippable with the supplied Publisher, using the supplied combining function
|
default <U> LazySeq<Tuple2<T,U>> |
zip(java.lang.Iterable<? extends U> other) |
default <U,R> LazySeq<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 <S,U> LazySeq<Tuple3<T,S,U>> |
zip3(java.lang.Iterable<? extends S> second,
java.lang.Iterable<? extends U> third)
zip 3 Streams into one
|
default <S,U,R> LazySeq<R> |
zip3(java.lang.Iterable<? extends S> second,
java.lang.Iterable<? extends U> third,
Function3<? super T,? super S,? super U,? extends R> fn3) |
default <T2,T3,T4> LazySeq<Tuple4<T,T2,T3,T4>> |
zip4(java.lang.Iterable<? extends T2> second,
java.lang.Iterable<? extends T3> third,
java.lang.Iterable<? extends T4> fourth)
zip 4 Streams into 1
|
default <T2,T3,T4,R> |
zip4(java.lang.Iterable<? extends T2> second,
java.lang.Iterable<? extends T3> third,
java.lang.Iterable<? extends T4> fourth,
Function4<? super T,? super T2,? super T3,? super T4,? extends R> fn) |
default LazySeq<Tuple2<T,java.lang.Long>> |
zipWithIndex()
Add an index to the current Stream
|
default <U> LazySeq<Tuple2<T,U>> |
zipWithPublisher(org.reactivestreams.Publisher<? extends U> other) |
default <U> LazySeq<Tuple2<T,U>> |
zipWithStream(java.util.stream.Stream<? extends U> other) |
default <U,R> LazySeq<R> |
zipWithStream(java.util.stream.Stream<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> zipper) |
compareTo, equalToDirectAccess, focusAt, focusAt, fold, fold, last, lazySeq, nonEmptyList, onEmptyTry, partition, seq, splitAt, tailOrElse, traversable
asFunction, equalToIteration, foldFuture, foldLazy, foldTry, forEach, forEach, forEach, forEach, forEach, forEachSubscribe, forEachSubscribe, forEachSubscribe, runFuture, runLazy, to, toHashSet, toSeq
fixedDelay, insertAt, onePer, subscribe, xPer
allMatch, anyMatch, atPercentile, bankersQueue, collect, collect, collect, collect, count, countDistinct, doubleStats, elementAt, endsWith, firstValue, foldLeft, foldLeft, foldLeft, foldLeft, foldLeft, foldMap, foldMap, foldMapRight, groupBy, hashSet, headOption, indexOf, indexOfSlice, intStats, iterableTo, join, join, join, lastIndexOf, lastIndexOfSlice, longStats, maxBy, maxBy, maximum, mean, median, minBy, minBy, minimum, mode, noneMatch, nonEmptyList, occurances, populationVariance, print, print, printErr, printOut, scheduleStream, single, single, singleOrElse, startsWith, stdDeviation, sumDouble, sumInt, sumLong, takeOne, toArray, toArray, toCollection, toHashMap, toHashMap, toList, toMap, toMap, toSet, treeSet, variance, vector, withPercentiles, xMatch
listView
static <T> java.util.stream.Collector<T,java.util.List<T>,LazySeq<T>> collector()
default <R> LazySeq<R> unitIterable(java.lang.Iterable<R> it)
Traversable
ReactiveSeq<Integer> newSeq = seq.unitIterable(myIterator);
unitIterable
in interface ImmutableList<T>
unitIterable
in interface IterableX<T>
unitIterable
in interface Traversable<T>
it
- Iterator to create new IterableFunctor fromdefault LazySeq<T> tailOrElseGet(java.util.function.Supplier<? extends LazySeq<T>> tail)
default boolean containsValue(T value)
containsValue
in interface ImmutableList<T>
containsValue
in interface IterableX<T>
containsValue
in interface PersistentCollection<T>
static <T,R> LazySeq<R> tailRec(T initial, java.util.function.Function<? super T,? extends LazySeq<? extends Either<T,R>>> fn)
static <T> LazySeq<T> fill(T t)
static <T> LazySeq<T> fill(long limit, T t)
static <U,T> LazySeq<T> unfold(U seed, java.util.function.Function<? super U,Option<Tuple2<T,U>>> unfolder)
static <T> LazySeq<T> iterate(T seed, java.util.function.UnaryOperator<T> f)
static <T> LazySeq<T> iterate(T seed, java.util.function.Predicate<? super T> pred, java.util.function.UnaryOperator<T> f)
static <T> LazySeq<T> iterate(T seed, java.util.function.UnaryOperator<T> f, long times)
static <T> LazySeq<T> deferred(java.util.function.Supplier<? extends java.lang.Iterable<? extends T>> lazy)
static <T> LazySeq<T> generate(java.util.function.Supplier<T> s)
static <T> LazySeq<T> generate(java.util.function.Supplier<T> s, long times)
static LazySeq<java.lang.Integer> range(int start, int end)
static LazySeq<java.lang.Integer> range(int start, int step, int end)
static LazySeq<java.lang.Long> rangeLong(long start, long step, long end)
static LazySeq<java.lang.Long> rangeLong(long start, long end)
default LazySeq<T> removeAll(java.lang.Iterable<? extends T> list)
IterableFilterable
removeAll
in interface ImmutableList<T>
removeAll
in interface IterableFilterable<T>
removeAll
in interface IterableX<T>
removeAll
in interface PersistentCollection<T>
removeAll
in interface PersistentList<T>
list
- an Iterable of elements to removeValuedefault <R> LazySeq<R> unitStream(java.util.stream.Stream<R> stream)
unitStream
in interface ImmutableList<T>
default ReactiveSeq<T> stream()
stream
in interface Folds<T>
stream
in interface ImmutableList<T>
stream
in interface IterableX<T>
stream
in interface PersistentCollection<T>
stream
in interface Traversable<T>
default LazySeq<T> removeAll(T... values)
IterableFilterable
removeAll
in interface ImmutableList<T>
removeAll
in interface IterableFilterable<T>
removeAll
in interface IterableX<T>
values
- to removeValuedefault LazySeq<T> plusAll(java.lang.Iterable<? extends T> t)
plusAll
in interface ImmutableList<T>
plusAll
in interface IterableX<T>
plusAll
in interface PersistentCollection<T>
plusAll
in interface PersistentList<T>
default LazySeq<T> insertAt(int pos, java.lang.Iterable<? extends T> list)
insertAt
in interface ImmutableList<T>
insertAt
in interface IterableX<T>
insertAt
in interface PersistentList<T>
insertAt
in interface Traversable<T>
LazySeq<T> updateAt(int i, T value)
updateAt
in interface ImmutableList<T>
updateAt
in interface IterableX<T>
updateAt
in interface PersistentList<T>
updateAt
in interface Traversable<T>
LazySeq<T> removeAt(int i)
removeAt
in interface ImmutableList<T>
removeAt
in interface IterableX<T>
removeAt
in interface PersistentList<T>
removeAt
in interface Traversable<T>
default LazySeq<T> insertAt(int i, T e)
insertAt
in interface ImmutableList<T>
insertAt
in interface IterableX<T>
insertAt
in interface PersistentList<T>
default LazySeq<T> removeValue(T value)
removeValue
in interface ImmutableList<T>
removeValue
in interface IterableX<T>
removeValue
in interface PersistentCollection<T>
removeValue
in interface PersistentList<T>
static <E extends java.lang.Enum<E>> LazySeq<E> enums(java.lang.Class<E> c)
LazyList.enums(Days.class)
.printOut();
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
E
- Enum typec
- Enum to processstatic <E extends java.lang.Enum<E>> LazySeq<E> enums(java.lang.Class<E> c, E start)
LazyList.enums(Days.class,Days.Wednesday)
.printOut();
Wednesday
Thursday
Friday
Saturday
Sunday
E
- Enum typec
- Enum to processstart
- Start valuestatic <E extends java.lang.Enum<E>> LazySeq<E> enumsFromTo(java.lang.Class<E> c, E start, E end)
LazyList.enums(Days.class,Days.Wednesday,Days.Friday)
.printOut();
Wednesday
Thursday
Friday
E
- Enum typec
- Enum to processstart
- Start valueend
- End valuestatic <E extends java.lang.Enum<E>> LazySeq<E> enums(java.lang.Class<E> c, E start, E step, E end)
LazyList.enums(Days.class,Days.Monday,Days.Wednesday,Days.Friday)
.printOut();
Monday
Wednesday
Friday
E
- Enum typec
- Enum to processstart
- Start valuestep
- Values for which the Distance from start in terms of the enum ordinal determines the stepping functionend
- End valuestatic <T> LazySeq<T> fromIterable(java.lang.Iterable<T> it)
static <T> LazySeq<T> fromIterator(java.util.Iterator<T> it)
static <T> LazySeq<T> fromStream(java.util.stream.Stream<T> stream)
@SafeVarargs static <T> LazySeq<T> of(T... value)
static <T> LazySeq<T> empty()
default Tuple2<ImmutableList<T>,ImmutableList<T>> span(java.util.function.Predicate<? super T> pred)
span
in interface ImmutableList<T>
default Tuple2<ImmutableList<T>,ImmutableList<T>> splitBy(java.util.function.Predicate<? super T> test)
splitBy
in interface ImmutableList<T>
default LazySeq<T> take(long n)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).take(2).toList(),equalTo(Arrays.asList(4,3));
take
in interface ImmutableList<T>
take
in interface IterableX<T>
take
in interface Traversable<T>
n
- Limit element size to numdefault LazySeq<T> takeWhile(java.util.function.Predicate<? super T> p)
Traversable
Seq.of(1,2,3).takeWhile(i<3);
//[1,2]
takeWhile
in interface ImmutableList<T>
takeWhile
in interface IterableX<T>
takeWhile
in interface Traversable<T>
p
- Predicate to determine when values should be takendefault LazySeq<T> dropWhile(java.util.function.Predicate<? super T> p)
Traversable
Seq.of(1,2,3).dropWhile(i<3);
//[3]
dropWhile
in interface ImmutableList<T>
dropWhile
in interface IterableX<T>
dropWhile
in interface Traversable<T>
p
- Predicate to determine when values should be droppeddefault LazySeq<T> drop(long num)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).drop(2).toList(),equalTo(Arrays.asList(6,7)));
drop
in interface ImmutableList<T>
drop
in interface IterableX<T>
drop
in interface Traversable<T>
num
- Number of elemenets to dropdefault LazySeq<T> reverse()
Traversable
assertThat( of(1, 2, 3).reverse().toList(),
equalTo(asList(3, 2, 1)));
reverse
in interface ImmutableList<T>
reverse
in interface IterableX<T>
reverse
in interface Traversable<T>
default <R1,R2> Tuple2<LazySeq<R1>,LazySeq<R2>> unzip(java.util.function.Function<? super T,Tuple2<? extends R1,? extends R2>> fn)
default ImmutableList<T> emptyUnit()
emptyUnit
in interface ImmutableList<T>
default LazySeq<T> replaceFirst(T currentElement, T newElement)
replaceFirst
in interface ImmutableList<T>
default Option<T> get(int pos)
get
in interface ImmutableList<T>
get
in interface PersistentIndexed<T>
default T getOrElse(int pos, T alt)
getOrElse
in interface ImmutableList<T>
getOrElse
in interface PersistentIndexed<T>
default T getOrElseGet(int pos, java.util.function.Supplier<? extends T> alt)
getOrElseGet
in interface ImmutableList<T>
getOrElseGet
in interface PersistentIndexed<T>
default LazySeq<T> removeFirst(java.util.function.Predicate<? super T> pred)
removeFirst
in interface ImmutableList<T>
removeFirst
in interface IterableX<T>
removeFirst
in interface Traversable<T>
default LazySeq<T> plus(T value)
plus
in interface ImmutableList<T>
plus
in interface IterableX<T>
plus
in interface PersistentCollection<T>
plus
in interface PersistentList<T>
default LazySeq<T> prependAll(java.lang.Iterable<? extends T> it)
prependAll
in interface ImmutableList<T>
prependAll
in interface IterableX<T>
prependAll
in interface Traversable<T>
default LazySeq<T> append(T append)
append
in interface ImmutableList<T>
append
in interface IterableX<T>
append
in interface Traversable<T>
default java.util.Iterator<T> iterator()
iterator
in interface ImmutableList<T>
iterator
in interface java.lang.Iterable<T>
<R> LazySeq<R> map(java.util.function.Function<? super T,? extends R> fn)
Transformable
of(1,2,3).map(i->i*2)
//[2,4,6]
map
in interface FilterableTransformable<T>
map
in interface ImmutableList<T>
map
in interface IterableX<T>
map
in interface Transformable<T>
map
in interface Traversable<T>
fn
- Transformation function<R> LazySeq<R> flatMap(java.util.function.Function<? super T,? extends ImmutableList<? extends R>> fn)
flatMap
in interface ImmutableList<T>
<R> LazySeq<R> concatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> fn)
IterableX
<R> LazySeq<R> mergeMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn)
<R> LazySeq<R> mergeMap(int maxConcurecy, java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn)
default LazySeq<T> appendAll(java.lang.Iterable<? extends T> it)
appendAll
in interface ImmutableList<T>
appendAll
in interface IterableX<T>
appendAll
in interface Traversable<T>
default <R> R foldLeft(R zero, java.util.function.BiFunction<R,? super T,R> f)
default LazySeq<T> subList(int start, int end)
subList
in interface ImmutableList<T>
default <U> LazySeq<U> ofType(java.lang.Class<? extends U> type)
Filters
// (1, 2, 3) ReactiveSeq.of(1, "a", 2, "b",3).ofType(Integer.class)
default LazySeq<T> filterNot(java.util.function.Predicate<? super T> predicate)
Filters
of(1,2,3).filter(i->i>2);
//[1,2]
filterNot
in interface Filters<T>
filterNot
in interface ImmutableList<T>
filterNot
in interface IterableX<T>
filterNot
in interface Traversable<T>
predicate
- to filter elements by, retaining matchesdefault LazySeq<T> notNull()
Filters
of(1,2,null,4).nonNull();
//[1,2,4]
default LazySeq<T> peek(java.util.function.Consumer<? super T> c)
Transformable
of(1,2,3).map(System.out::println)
1
2
3
peek
in interface ImmutableList<T>
peek
in interface IterableX<T>
peek
in interface Transformable<T>
c
- Consumer that recieves each element from this Transformabledefault LazySeq<T> removeStream(java.util.stream.Stream<? extends T> stream)
IterableFilterable
removeStream
in interface ImmutableList<T>
removeStream
in interface IterableFilterable<T>
removeStream
in interface IterableX<T>
stream
- of elements to removedefault LazySeq<T> retainAll(java.lang.Iterable<? extends T> it)
IterableFilterable
retainAll
in interface ImmutableList<T>
retainAll
in interface IterableFilterable<T>
retainAll
in interface IterableX<T>
it
- Iterable of elements to retaindefault LazySeq<T> retainStream(java.util.stream.Stream<? extends T> stream)
IterableFilterable
retainStream
in interface ImmutableList<T>
retainStream
in interface IterableFilterable<T>
retainStream
in interface IterableX<T>
stream
- of elements to retaindefault LazySeq<T> retainAll(T... values)
IterableFilterable
retainAll
in interface ImmutableList<T>
retainAll
in interface IterableFilterable<T>
retainAll
in interface IterableX<T>
values
- elements to retaindefault LazySeq<ReactiveSeq<T>> permutations()
permutations
in interface ImmutableList<T>
permutations
in interface IterableX<T>
default LazySeq<ReactiveSeq<T>> combinations(int size)
combinations
in interface ImmutableList<T>
combinations
in interface IterableX<T>
default LazySeq<ReactiveSeq<T>> combinations()
combinations
in interface ImmutableList<T>
combinations
in interface IterableX<T>
default <T2,R> LazySeq<R> zip(java.util.function.BiFunction<? super T,? super T2,? extends R> fn, org.reactivestreams.Publisher<? extends T2> publisher)
Zippable
default <U,R> LazySeq<R> zipWithStream(java.util.stream.Stream<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
zipWithStream
in interface ImmutableList<T>
zipWithStream
in interface IterableX<T>
zipWithStream
in interface Traversable<T>
default <U> LazySeq<Tuple2<T,U>> zipWithPublisher(org.reactivestreams.Publisher<? extends U> other)
zipWithPublisher
in interface ImmutableList<T>
zipWithPublisher
in interface IterableX<T>
zipWithPublisher
in interface Traversable<T>
zipWithPublisher
in interface Zippable<T>
default <S,U,R> LazySeq<R> zip3(java.lang.Iterable<? extends S> second, java.lang.Iterable<? extends U> third, Function3<? super T,? super S,? super U,? extends R> fn3)
default <T2,T3,T4,R> LazySeq<R> zip4(java.lang.Iterable<? extends T2> second, java.lang.Iterable<? extends T3> third, java.lang.Iterable<? extends T4> fourth, Function4<? super T,? super T2,? super T3,? super T4,? extends R> fn)
default LazySeq<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),SemigroupK.intSum)
.listX()
//Seq(3,4)
combine
in interface ImmutableList<T>
combine
in interface IterableX<T>
combine
in interface Traversable<T>
predicate
- Test to see if two neighbours should be joined. The first parameter to the bi-predicate is the currently
accumulated result and the second is the next elementop
- BinaryOperator to combine neighboursdefault LazySeq<T> combine(Monoid<T> op, java.util.function.BiPredicate<? super T,? super T> predicate)
Traversable
ReactiveSeq.of(1,1,2,3)
.combine(Monoids.intMult,(a, b)->a.equals(b))
.listX()
//Seq(1)
Simalar to @see Traversable.combine(BiPredicate, BinaryOperator)
but differs in that the first comparison is always to the Monoid zero
This allows us to terminate with just a single valuecombine
in interface ImmutableList<T>
combine
in interface IterableX<T>
combine
in interface Traversable<T>
op
- Monoid to combine neighbourspredicate
- Test to see if two neighbours should be joined. The first parameter to the bi-predicate is the currently
accumulated result and the second is the next elementdefault LazySeq<T> cycle(long times)
Traversable
ReactiveSeq.of(1,2,2)
.cycle(3)
.collect(CyclopsCollectors.toList());
//List[1,2,2,1,2,2,1,2,2]
cycle
in interface ImmutableList<T>
cycle
in interface IterableX<T>
cycle
in interface Traversable<T>
times
- Times values should be repeated within a Streamdefault LazySeq<T> cycle(Monoid<T> m, long times)
Traversable
List<Integer> list = ReactiveSeq.of(1,2,2))
.cycle(Reducers.toCountInt(),3)
.collect(CyclopsCollectors.toList());
//List[3,3,3];
cycle
in interface ImmutableList<T>
cycle
in interface IterableX<T>
cycle
in interface Traversable<T>
m
- Monoid to be used in reductiontimes
- Number of times value should be repeateddefault LazySeq<T> cycleWhile(java.util.function.Predicate<? super T> predicate)
Traversable
MutableInt count = MutableInt.of(0);
ReactiveSeq.of(1, 2, 2).cycleWhile(next -> count++ < 6).collect(CyclopsCollectors.toList());
// List(1,2,2,1,2,2)
cycleWhile
in interface ImmutableList<T>
cycleWhile
in interface IterableX<T>
cycleWhile
in interface Traversable<T>
predicate
- repeat while truedefault LazySeq<T> cycleUntil(java.util.function.Predicate<? super T> predicate)
Traversable
MutableInt count =MutableInt.of(0);
ReactiveSeq.of(1,2,2)
.cycleUntil(next -> count.getValue()>6)
.peek(i-> count.mutate(i->i+1))
.collect(CyclopsCollectors.toList());
//List[1,2,2,1,2,2,1]
cycleUntil
in interface ImmutableList<T>
cycleUntil
in interface IterableX<T>
cycleUntil
in interface Traversable<T>
predicate
- repeat while truedefault <U,R> LazySeq<R> zip(java.lang.Iterable<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zippable
default <S,U> LazySeq<Tuple3<T,S,U>> zip3(java.lang.Iterable<? extends S> second, java.lang.Iterable<? extends U> third)
Traversable
List<Tuple3<Integer, Integer, Character>> list = of(1, 2, 3, 4, 5, 6).zip3(of(100, 200, 300, 400), of('a', 'b', 'c')).collect(CyclopsCollectors.toList());
// [[1,100,'a'],[2,200,'b'],[3,300,'c']]
default <T2,T3,T4> LazySeq<Tuple4<T,T2,T3,T4>> zip4(java.lang.Iterable<? extends T2> second, java.lang.Iterable<? extends T3> third, java.lang.Iterable<? extends T4> fourth)
Traversable
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(CyclopsCollectors.toList());
// [[1,100,'a',"hello"],[2,200,'b',"world"]]
default LazySeq<Tuple2<T,java.lang.Long>> zipWithIndex()
Traversable
assertEquals(asList(new Tuple2("a", 0L), new Tuple2("b", 1L)), of("a", "b").zipWithIndex().toList());
zipWithIndex
in interface ImmutableList<T>
zipWithIndex
in interface IterableX<T>
zipWithIndex
in interface Traversable<T>
default LazySeq<Seq<T>> sliding(int windowSize)
Traversable
List<List<Integer>> list = ReactiveSeq.of(1, 2, 3, 4, 5, 6).sliding(2).collect(CyclopsCollectors.toList());
assertThat(list.getValue(0), hasItems(1, 2));
assertThat(list.getValue(1), hasItems(2, 3));
sliding
in interface ImmutableList<T>
sliding
in interface IterableX<T>
sliding
in interface Traversable<T>
windowSize
- Size of sliding windowdefault LazySeq<Seq<T>> sliding(int windowSize, int increment)
Traversable
List<List<Integer>> list = ReactiveSeq.of(1, 2, 3, 4, 5, 6).sliding(3, 2).collect(CyclopsCollectors.toList());
assertThat(list.getValue(0), hasItems(1, 2, 3));
assertThat(list.getValue(1), hasItems(3, 4, 5));
sliding
in interface ImmutableList<T>
sliding
in interface IterableX<T>
sliding
in interface Traversable<T>
windowSize
- number of elements in each batchincrement
- for each windowdefault <C extends PersistentCollection<? super T>> LazySeq<C> grouped(int size, java.util.function.Supplier<C> supplier)
Traversable
assertThat(ReactiveSeq.of(1,1,1,1,1,1)
.batchBySize(3,()->new TreeSet<>())
.toList()
.getValue(0)
.size(),is(1));
grouped
in interface ImmutableList<T>
grouped
in interface IterableX<T>
grouped
in interface Traversable<T>
size
- batch sizesupplier
- Collection factorydefault LazySeq<Vector<T>> groupedUntil(java.util.function.Predicate<? super T> predicate)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedUntil(i->i%3==0)
.toList()
.size(),equalTo(2));
groupedUntil
in interface ImmutableList<T>
groupedUntil
in interface IterableX<T>
groupedUntil
in interface Traversable<T>
predicate
- Batch until predicate holds, applyHKT open next batchdefault LazySeq<Vector<T>> groupedUntil(java.util.function.BiPredicate<Vector<? super T>,? super T> predicate)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedUntil((s,i)->s.contains(4) ? true : false)
.toList().size(),equalTo(5));
groupedUntil
in interface ImmutableList<T>
groupedUntil
in interface IterableX<T>
groupedUntil
in interface Traversable<T>
predicate
- Window while truedefault <U> LazySeq<Tuple2<T,U>> zipWithStream(java.util.stream.Stream<? extends U> other)
zipWithStream
in interface ImmutableList<T>
zipWithStream
in interface IterableX<T>
zipWithStream
in interface Traversable<T>
default LazySeq<Vector<T>> groupedWhile(java.util.function.Predicate<? super T> predicate)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedWhile(i->i%3!=0)
.toList().size(),equalTo(2));
groupedWhile
in interface ImmutableList<T>
groupedWhile
in interface IterableX<T>
groupedWhile
in interface Traversable<T>
predicate
- Batch while predicate holds, applyHKT open next batchdefault <C extends PersistentCollection<? super T>> LazySeq<C> groupedWhile(java.util.function.Predicate<? super T> predicate, java.util.function.Supplier<C> factory)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedWhile(i->i%3!=0)
.toList()
.size(),equalTo(2));
groupedWhile
in interface ImmutableList<T>
groupedWhile
in interface IterableX<T>
groupedWhile
in interface Traversable<T>
predicate
- Batch while predicate holds, applyHKT open next batchfactory
- Collection factorydefault <C extends PersistentCollection<? super T>> LazySeq<C> groupedUntil(java.util.function.Predicate<? super T> predicate, java.util.function.Supplier<C> factory)
Traversable
ReactiveSeq.of(1,2,3,4,5,6)
.groupedUntil(i->i%3!=0)
.toList()
//2
groupedUntil
in interface ImmutableList<T>
groupedUntil
in interface IterableX<T>
groupedUntil
in interface Traversable<T>
predicate
- Batch until predicate holds, applyHKT open next batchfactory
- Collection factorydefault LazySeq<Vector<T>> grouped(int groupSize)
Traversable
List<List<Integer>> list = ReactiveSeq.of(1, 2, 3, 4, 5, 6).grouped(3).collect(CyclopsCollectors.toList());
assertThat(list.getValue(0), hasItems(1, 2, 3));
assertThat(list.getValue(1), hasItems(4, 5, 6));
grouped
in interface ImmutableList<T>
grouped
in interface IterableX<T>
grouped
in interface Traversable<T>
groupSize
- Size of each Groupdefault LazySeq<T> distinct()
distinct
in interface ImmutableList<T>
distinct
in interface IterableX<T>
distinct
in interface Traversable<T>
default LazySeq<T> scanLeft(Monoid<T> monoid)
Traversable
assertEquals(asList("", "a", "ab", "abc"),ReactiveSeq.of("a", "b", "c")
.scanLeft(Reducers.toString("")).toList());
scanLeft
in interface ImmutableList<T>
scanLeft
in interface IterableX<T>
scanLeft
in interface Traversable<T>
default <U> LazySeq<U> scanLeft(U seed, java.util.function.BiFunction<? super U,? super T,? extends U> function)
Traversable
assertThat(of("a", "b", "c").scanLeft("", String::concat).toList().size(),
is(4));
scanLeft
in interface ImmutableList<T>
scanLeft
in interface IterableX<T>
scanLeft
in interface Traversable<T>
default LazySeq<T> scanRight(Monoid<T> monoid)
Traversable
assertThat(of("a", "b", "c").scanRight(Monoid.of("", String::concat)).toList().size(),
is(asList("", "c", "bc", "abc").size()));
scanRight
in interface ImmutableList<T>
scanRight
in interface IterableX<T>
scanRight
in interface Traversable<T>
default <U> LazySeq<U> scanRight(U identity, java.util.function.BiFunction<? super T,? super U,? extends U> combiner)
Traversable
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 ImmutableList<T>
scanRight
in interface IterableX<T>
scanRight
in interface Traversable<T>
default LazySeq<T> sorted()
Traversable
assertThat(ReactiveSeq.of(4,3,6,7)).sorted().toList(),equalTo(Arrays.asList(3,4,6,7)));
sorted
in interface ImmutableList<T>
sorted
in interface IterableX<T>
sorted
in interface Traversable<T>
default LazySeq<T> sorted(java.util.Comparator<? super T> c)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).sorted((a,b) -> b-a).toList(),equalTo(Arrays.asList(7,6,4,3)));
sorted
in interface ImmutableList<T>
sorted
in interface IterableX<T>
sorted
in interface Traversable<T>
c
- Compartor to sort withdefault LazySeq<T> takeUntil(java.util.function.Predicate<? super T> p)
Traversable
Seq.of(1,2,3).takeUntil(i<2);
//[1,2]
takeUntil
in interface ImmutableList<T>
takeUntil
in interface IterableX<T>
takeUntil
in interface Traversable<T>
p
- Predicate to determine when values should be taken untildefault LazySeq<T> dropUntil(java.util.function.Predicate<? super T> p)
Traversable
Seq.of(1,2,3).dropUntil(i>2);
//[3]
dropUntil
in interface ImmutableList<T>
dropUntil
in interface IterableX<T>
dropUntil
in interface Traversable<T>
p
- Predicate to determine when values should be droppeddefault LazySeq<T> removeAt(long pos)
removeAt
in interface ImmutableList<T>
removeAt
in interface IterableX<T>
removeAt
in interface Traversable<T>
default LazySeq<T> insertAt(int pos, T... values)
Traversable
List<String> result = ReactiveSeq.of(1, 2, 3).insertAt(1, 100, 200, 300).map(it -> it + "!!").collect(CyclopsCollectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "100!!", "200!!", "300!!", "2!!", "3!!"))); *
insertAt
in interface ImmutableList<T>
insertAt
in interface IterableX<T>
insertAt
in interface Traversable<T>
pos
- to insert data atvalues
- to insertdefault LazySeq<T> dropRight(int num)
Traversable
Seq.of(1,2,3).dropRight(2);
//[1]
dropRight
in interface ImmutableList<T>
dropRight
in interface IterableX<T>
dropRight
in interface Traversable<T>
num
- Drop this number of elements from the take of this Traversabledefault LazySeq<T> takeRight(int num)
Traversable
Seq.of(1,2,3).takeRight(2);
//[2,3]
takeRight
in interface ImmutableList<T>
takeRight
in interface IterableX<T>
takeRight
in interface Traversable<T>
num
- Take this number of elements from the take of this Traversabledefault LazySeq<T> skip(long num)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).skip(2).toList(),equalTo(Arrays.asList(6,7)));
skip
in interface ImmutableList<T>
skip
in interface IterableX<T>
skip
in interface Traversable<T>
num
- Number of elemenets to skipdefault LazySeq<T> skipWhile(java.util.function.Predicate<? super T> p)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).sorted().skipWhile(i->i<6).toList(),equalTo(Arrays.asList(6,7)));
skipWhile
in interface ImmutableList<T>
skipWhile
in interface IterableX<T>
skipWhile
in interface Traversable<T>
p
- Predicate to skip while truedefault LazySeq<T> skipUntil(java.util.function.Predicate<? super T> p)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).skipUntil(i->i==6).toList(),equalTo(Arrays.asList(6,7)));
skipUntil
in interface ImmutableList<T>
skipUntil
in interface IterableX<T>
skipUntil
in interface Traversable<T>
p
- Predicate to skip until truedefault LazySeq<T> limit(long num)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).limit(2).toList(),equalTo(Arrays.asList(4,3));
limit
in interface ImmutableList<T>
limit
in interface IterableX<T>
limit
in interface Traversable<T>
num
- Limit element size to numdefault LazySeq<T> limitWhile(java.util.function.Predicate<? super T> p)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).sorted().limitWhile(i->i<6).toList(),equalTo(Arrays.asList(3,4)));
limitWhile
in interface ImmutableList<T>
limitWhile
in interface IterableX<T>
limitWhile
in interface Traversable<T>
p
- Limit while predicate is truedefault LazySeq<T> limitUntil(java.util.function.Predicate<? super T> p)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).limitUntil(i->i==6).toList(),equalTo(Arrays.asList(4,3)));
limitUntil
in interface ImmutableList<T>
limitUntil
in interface IterableX<T>
limitUntil
in interface Traversable<T>
p
- Limit until predicate is truedefault LazySeq<T> intersperse(T value)
Traversable
intersperse
in interface ImmutableList<T>
intersperse
in interface IterableX<T>
intersperse
in interface Traversable<T>
default LazySeq<T> shuffle()
shuffle
in interface ImmutableList<T>
shuffle
in interface IterableX<T>
shuffle
in interface Traversable<T>
default LazySeq<T> skipLast(int num)
Traversable
skipLast
in interface ImmutableList<T>
skipLast
in interface IterableX<T>
skipLast
in interface Traversable<T>
default LazySeq<T> limitLast(int num)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5)
.limitLast(2)
.collect(CyclopsCollectors.toList()),equalTo(Arrays.asList(4,5)));
limitLast
in interface ImmutableList<T>
limitLast
in interface IterableX<T>
limitLast
in interface Traversable<T>
num
- of elements to return (last elements)default LazySeq<T> shuffle(java.util.Random random)
shuffle
in interface ImmutableList<T>
shuffle
in interface IterableX<T>
shuffle
in interface Traversable<T>
default LazySeq<T> slice(long from, long to)
slice
in interface ImmutableList<T>
slice
in interface IterableX<T>
slice
in interface Traversable<T>
LazySeq<T> onEmpty(T value)
OnEmpty
LazySeq<T> onEmptyGet(java.util.function.Supplier<? extends T> supplier)
OnEmpty
onEmptyGet
in interface ImmutableList<T>
onEmptyGet
in interface IterableX<T>
onEmptyGet
in interface OnEmpty<T>
onEmptyGet
in interface Traversable<T>
supplier
- to determine new value for containerdefault LazySeq<T> prependStream(java.util.stream.Stream<? extends T> stream)
Traversable
List<String> result = ReactiveSeq.of(1, 2, 3)
.prependStream(of(100, 200, 300))
.map(it -> it + "!!")
.collect(CyclopsCollectors.toList());
assertThat(result, equalTo(Arrays.asList("100!!", "200!!", "300!!", "1!!", "2!!", "3!!")));
prependStream
in interface ImmutableList<T>
prependStream
in interface IterableX<T>
prependStream
in interface Traversable<T>
stream
- to Prependdefault LazySeq<T> appendAll(T... values)
Traversable
List<String> result = ReactiveSeq.of(1, 2, 3).append(100, 200, 300).map(it -> it + "!!").collect(CyclopsCollectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "2!!", "3!!", "100!!", "200!!", "300!!"))); *
appendAll
in interface ImmutableList<T>
appendAll
in interface IterableX<T>
appendAll
in interface Traversable<T>
values
- to appenddefault LazySeq<T> prependAll(T... values)
Traversable
List<String> result = ReactiveSeq.of(1,2,3)
.prependAll(100,200,300)
.map(it ->it+"!!")
.collect(CyclopsCollectors.toList());
assertThat(result,equalTo(Arrays.asList("100!!","200!!","300!!","1!!","2!!","3!!")));
prependAll
in interface ImmutableList<T>
prependAll
in interface IterableX<T>
prependAll
in interface Traversable<T>
values
- to prependAlldefault LazySeq<T> deleteBetween(int start, int end)
Traversable
List<String> result = ReactiveSeq.of(1, 2, 3, 4, 5, 6).deleteBetween(2, 4).map(it -> it + "!!").collect(CyclopsCollectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "2!!", "5!!", "6!!"))); *
deleteBetween
in interface ImmutableList<T>
deleteBetween
in interface IterableX<T>
deleteBetween
in interface Traversable<T>
start
- indexend
- indexdefault LazySeq<T> insertStreamAt(int pos, java.util.stream.Stream<T> stream)
Traversable
List<String> result = ReactiveSeq.of(1, 2, 3).insertAt(1, of(100, 200, 300)).map(it -> it + "!!").collect(CyclopsCollectors.toList());
assertThat(result, equalTo(Arrays.asList("1!!", "100!!", "200!!", "300!!", "2!!", "3!!")));
insertStreamAt
in interface ImmutableList<T>
insertStreamAt
in interface IterableX<T>
insertStreamAt
in interface Traversable<T>
pos
- to insert Stream atstream
- to insertdefault LazySeq<T> prepend(T value)
prepend
in interface ImmutableList<T>
prepend
in interface IterableX<T>
prepend
in interface Traversable<T>
default <U extends java.lang.Comparable<? super U>> LazySeq<T> sorted(java.util.function.Function<? super T,? extends U> function)
sorted
in interface ImmutableList<T>
sorted
in interface IterableX<T>
sorted
in interface Traversable<T>
default java.lang.String mkString()
default <R> R foldRight(R zero, java.util.function.BiFunction<? super T,? super R,? extends R> f)
Folds
default T foldRight(T identity, java.util.function.BinaryOperator<T> accumulator)
Folds
assertTrue(ReactiveSeq.of("a","b","c").foldRight("", String::concat).equals("cba"));
default T foldRight(Monoid<T> reducer)
Folds
ReactiveSeq.of("a","b","c").foldRight(Reducers.toString(""));
// "cab"
LazySeq<T> filter(java.util.function.Predicate<? super T> pred)
Filters
of(1,2,3).filter(i->i>2);
//[3]
filter
in interface FilterableTransformable<T>
filter
in interface Filters<T>
filter
in interface ImmutableList<T>
filter
in interface IterableX<T>
pred
- to filter elements by, retaining matches<R> R foldLazySeq(java.util.function.Function<? super LazySeq.Cons<T>,? extends R> fn1, java.util.function.Function<? super LazySeq.Nil,? extends R> fn2)
int size()
size
in interface ImmutableList<T>
size
in interface IterableX<T>
size
in interface PersistentCollection<T>
boolean isEmpty()
isEmpty
in interface ImmutableList<T>
isEmpty
in interface IterableX<T>
isEmpty
in interface PersistentCollection<T>
static <T> LazySeq<T> lazy(T head, java.util.function.Supplier<ImmutableList<T>> tail)
static <T> LazySeq<T> narrowK(Higher<DataWitness.lazySeq,T> list)
static <C2,T> Higher<C2,Higher<DataWitness.lazySeq,T>> widen2(Higher<C2,LazySeq<T>> list)
ImmutableList<T> onEmptySwitch(java.util.function.Supplier<? extends ImmutableList<T>> supplier)
OnEmptySwitch
Seq.zero().onEmptySwitch(()->Seq.of(1));
onEmptySwitch
in interface ImmutableList<T>
onEmptySwitch
in interface OnEmptySwitch<ImmutableList<T>,ImmutableList<T>>
supplier
- to create replacement containerdefault <R1,R2,R3,R> LazySeq<R> forEach4(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2, Function3<? super T,? super R1,? super R2,? extends java.lang.Iterable<R3>> iterable3, Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
forEach4
in interface ImmutableList<T>
default <R1,R2,R3,R> LazySeq<R> forEach4(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2, Function3<? super T,? super R1,? super R2,? extends java.lang.Iterable<R3>> iterable3, Function4<? super T,? super R1,? super R2,? super R3,java.lang.Boolean> filterFunction, Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
forEach4
in interface ImmutableList<T>
default <R1,R2,R> LazySeq<R> forEach3(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2, Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction)
forEach3
in interface ImmutableList<T>
default <R1,R2,R> LazySeq<R> forEach3(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2, Function3<? super T,? super R1,? super R2,java.lang.Boolean> filterFunction, Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction)
forEach3
in interface ImmutableList<T>
default <R1,R> LazySeq<R> forEach2(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
forEach2
in interface ImmutableList<T>
default <R1,R> LazySeq<R> forEach2(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,java.lang.Boolean> filterFunction, java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
forEach2
in interface ImmutableList<T>
<R> R lazyFoldRight(R zero, java.util.function.BiFunction<? super T,java.util.function.Supplier<R>,? extends R> f)
static <T> Higher<DataWitness.lazySeq,T> widen(LazySeq<T> narrow)