public static final class Seq.Cons<T> extends java.lang.Object implements ImmutableList.Some<T>, Seq<T>, java.io.Serializable
Deconstruct.Deconstruct1<T1>, Deconstruct.Deconstruct2<T1,T2>, Deconstruct.Deconstruct3<T1,T2,T3>, Deconstruct.Deconstruct4<T1,T2,T3,T4>, Deconstruct.Deconstruct5<T1,T2,T3,T4,T5>
ImmutableList.None<T>, ImmutableList.Some<T>
Constructor and Description |
---|
Cons() |
Modifier and Type | Method and Description |
---|---|
<R> Seq<R> |
concatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
Perform a flatMap operation on this IterableX.
|
static <T> Seq.Cons<T> |
cons(T value,
Seq<T> tail) |
boolean |
equals(java.lang.Object obj) |
<R> R |
foldSeq(java.util.function.Function<? super Seq.Cons<T>,? extends R> fn1,
java.util.function.Function<? super Seq.Nil,? extends R> fn2) |
int |
hashCode() |
T |
head() |
Seq<T> |
insertAt(int i,
java.lang.Iterable<? extends T> list) |
Seq<T> |
insertAt(int i,
T value) |
boolean |
isEmpty() |
<R> Seq<R> |
map(java.util.function.Function<? super T,? extends R> fn)
Transform this functor using the supplied transformation function
|
<R> Seq<R> |
mergeMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn) |
<R> Seq<R> |
mergeMap(int maxConcurecy,
java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn) |
Seq.Cons<T> |
onEmpty(T value)
If this Container instance is zero, create a new instance containing the provided value
|
Seq.Cons<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
|
Seq.Cons<T> |
onEmptySwitch(java.util.function.Supplier<? extends ImmutableList<T>> supplier)
Switch to container created by provided Supplier, if current Container zero
|
Seq<T> |
removeAt(int i) |
Seq<T> |
removeValue(T e) |
Seq.Cons<T> |
reverse()
Potentially efficient Stream reversal.
|
int |
size() |
Seq<T> |
tail() |
java.lang.String |
toString() |
Tuple2<T,ImmutableList<T>> |
unapply() |
Seq<T> |
updateAt(int i,
T value) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
fold
fold
append, appendAll, appendAll, collector, combinations, combinations, combine, combine, containsValue, cycle, cycle, cycleUntil, cycleWhile, deleteBetween, distinct, drop, dropRight, dropUntil, dropWhile, empty, emptyUnit, fill, filter, filterNot, flatMap, foldLeft, foldLeft, foldRight, foldRight, forEach2, forEach2, forEach3, forEach3, forEach4, forEach4, fromIterable, fromIterator, fromStream, generate, generate, get, getOrElse, getOrElseGet, grouped, grouped, groupedUntil, groupedUntil, groupedUntil, groupedWhile, groupedWhile, headOrElse, headOrElseGet, insertAt, insertStreamAt, intersperse, iterate, iterate, iterator, limit, limitLast, limitUntil, limitWhile, linkedSeq, narrow, narrowK, notNull, of, ofType, peek, permutations, plus, plusAll, prepend, prependAll, prependAll, prependStream, range, range, rangeLong, rangeLong, removeAll, removeAll, removeAt, removeFirst, removeStream, replaceFirst, retainAll, retainAll, retainStream, scanLeft, scanLeft, scanRight, scanRight, shuffle, shuffle, skip, skipLast, skipUntil, skipWhile, slice, sliding, sliding, sorted, sorted, sorted, stream, subList, tailOrElse, tailOrElse, tailOrElseGet, tailRec, take, takeRight, takeUntil, takeWhile, unfold, unitIterable, unitStream, unzip, widen, widen2, zip, zip, zip, zip3, zip3, zip4, zip4, zipWithIndex, zipWithPublisher, zipWithStream, zipWithStream
compareTo, equalToDirectAccess, focusAt, focusAt, fold, last, lazySeq, nonEmptyList, onEmptyTry, partition, seq, span, splitAt, splitBy, 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, foldMap, foldMap, foldMapRight, foldRight, 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
public Tuple2<T,ImmutableList<T>> unapply()
unapply
in interface Deconstruct<Tuple2<T,ImmutableList<T>>>
public boolean isEmpty()
public <R> Seq<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 Transformable<T>
map
in interface IterableX<T>
map
in interface Traversable<T>
map
in interface ImmutableList<T>
map
in interface Seq<T>
fn
- Transformation functionpublic Seq<T> tail()
tail
in interface ImmutableList.Some<T>
public Seq<T> removeAt(int i)
removeAt
in interface PersistentList<T>
removeAt
in interface IterableX<T>
removeAt
in interface Traversable<T>
removeAt
in interface ImmutableList<T>
removeAt
in interface Seq<T>
public Seq<T> updateAt(int i, T value)
updateAt
in interface PersistentList<T>
updateAt
in interface IterableX<T>
updateAt
in interface Traversable<T>
updateAt
in interface ImmutableList<T>
updateAt
in interface Seq<T>
public Seq<T> insertAt(int i, java.lang.Iterable<? extends T> list)
insertAt
in interface PersistentList<T>
insertAt
in interface IterableX<T>
insertAt
in interface Traversable<T>
insertAt
in interface ImmutableList<T>
insertAt
in interface Seq<T>
public Seq<T> removeValue(T e)
removeValue
in interface PersistentCollection<T>
removeValue
in interface PersistentList<T>
removeValue
in interface IterableX<T>
removeValue
in interface ImmutableList<T>
removeValue
in interface Seq<T>
public T head()
head
in interface ImmutableList.Some<T>
public Seq.Cons<T> reverse()
Traversable
assertThat( of(1, 2, 3).reverse().toList(),
equalTo(asList(3, 2, 1)));
reverse
in interface IterableX<T>
reverse
in interface Traversable<T>
reverse
in interface ImmutableList<T>
reverse
in interface ImmutableList.Some<T>
reverse
in interface Seq<T>
public int size()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public <R> R foldSeq(java.util.function.Function<? super Seq.Cons<T>,? extends R> fn1, java.util.function.Function<? super Seq.Nil,? extends R> fn2)
public Seq.Cons<T> onEmpty(T value)
OnEmpty
onEmpty
in interface OnEmpty<T>
onEmpty
in interface IterableX<T>
onEmpty
in interface Traversable<T>
onEmpty
in interface ImmutableList<T>
onEmpty
in interface Seq<T>
public Seq.Cons<T> onEmptyGet(java.util.function.Supplier<? extends T> supplier)
OnEmpty
onEmptyGet
in interface OnEmpty<T>
onEmptyGet
in interface IterableX<T>
onEmptyGet
in interface Traversable<T>
onEmptyGet
in interface ImmutableList<T>
onEmptyGet
in interface Seq<T>
supplier
- to determine new value for containerpublic <R> Seq<R> concatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> mapper)
IterableX
concatMap
in interface IterableX<T>
concatMap
in interface ImmutableList<T>
concatMap
in interface Seq<T>
mapper
- Transformation function to be applied (and flattened)public <R> Seq<R> mergeMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn)
public <R> Seq<R> mergeMap(int maxConcurecy, java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn)
public Seq.Cons<T> onEmptySwitch(java.util.function.Supplier<? extends ImmutableList<T>> supplier)
OnEmptySwitch
Seq.zero().onEmptySwitch(()->Seq.of(1));
onEmptySwitch
in interface OnEmptySwitch<ImmutableList<T>,ImmutableList<T>>
onEmptySwitch
in interface ImmutableList<T>
supplier
- to create replacement container