public class ListSequence<T> extends java.lang.Object implements Sequence<T>
Sequence backed by a List. Implements certain operations on Sequence in a more performant
way due to the List backing. This class should normally not be used directly as e.g.
Sequence.from(Iterable) and other methods return this class directly where appropriate.| Modifier and Type | Method and Description |
|---|---|
Sequence<T> |
append(java.lang.Iterable<T> iterable)
Append the elements of the given
Iterable to the end of this Sequence. |
Sequence<T> |
append(T... items)
Append the given elements to the end of this
Sequence. |
java.util.Optional<T> |
at(int index) |
void |
clear() |
<U extends java.util.Collection<T>> |
collectInto(U collection)
Collect this
Sequence into the given Collection. |
static <T> Sequence<T> |
concat(java.util.List<java.util.List<T>> lists) |
static <T> Sequence<T> |
concat(java.util.List<T>... lists) |
boolean |
contains(java.lang.Object item) |
static <T> Sequence<T> |
empty()
Create an empty
Sequence with no items. |
Sequence<T> |
filter(java.util.function.Predicate<? super T> predicate)
Filter the elements in this
Sequence, keeping only the elements that match the given Predicate. |
static <T> Sequence<T> |
from(java.util.List<T> list) |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
java.util.Optional<T> |
last() |
<U> Sequence<U> |
map(java.util.function.Function<? super T,? extends U> mapper)
Map the values in this
Sequence to another set of values specified by the given mapper function. |
static <T> Sequence<T> |
of(T... items)
Create a
Sequence with one item. |
static <T> Sequence<T> |
of(T item)
Create a
Sequence with one item. |
Sequence<T> |
reverse() |
int |
size() |
java.util.stream.Stream<T> |
stream() |
java.util.List<T> |
toList()
Collect the elements in this
Sequence into a List. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadjacentEntries, adjacentPairs, all, all, any, any, append, append, asList, at, at, batch, batch, cache, cache, cache, chars, charsFrom, collect, collect, collectInto, concat, concat, containsAll, containsAll, containsAny, containsAny, delimit, delimit, distinct, endingAt, endingAt, endingAtNull, entries, excluding, excluding, filter, filterBack, filterBack, filterForward, filterForward, filterIndexed, first, first, first, flatten, flatten, forEachIndexed, from, from, generate, including, including, index, interleave, ints, intsFrom, intsFromZero, join, join, join, last, last, limit, longs, longsFrom, longsFromZero, mapBack, mapBack, mapForward, mapForward, mapIndexed, max, max, min, min, multiGenerate, none, none, once, once, pairs, peek, peekBack, peekBack, peekForward, peekForward, peekIndexed, prefix, range, range, range, recurse, recurse, reduce, reduce, repeat, repeat, shuffle, shuffle, shuffle, skip, skipTail, sorted, sorted, split, split, startingAfter, startingAfter, startingFrom, startingFrom, step, suffix, swap, toArray, toBiSequence, toChars, toCollection, toDoubles, toEntrySequence, toInts, toList, toLongs, toMap, toMap, toMap, toMap, toSet, toSet, toSortedMap, toSortedMap, toSortedSet, until, until, untilNull, window, windowadd, add, addAll, addAll, containsAll, get, indexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArraypublic static <T> Sequence<T> empty()
SequenceSequence with no items.empty in interface IterableCollection<T>empty in interface Sequence<T>Sequence.of(Object),
Sequence.of(Object...),
Sequence.from(Iterable)public static <T> Sequence<T> of(T item)
SequenceSequence with one item.of in interface IterableCollection<T>of in interface Sequence<T>Sequence.of(Object...),
Sequence.from(Iterable)public static <T> Sequence<T> of(T... items)
SequenceSequence with one item.of in interface IterableCollection<T>of in interface Sequence<T>Sequence.of(Object...),
Sequence.from(Iterable)public static <T> Sequence<T> from(java.util.List<T> list)
public static <T> Sequence<T> concat(java.util.List<T>... lists)
public static <T> Sequence<T> concat(java.util.List<java.util.List<T>> lists)
public java.util.Iterator<T> iterator()
public java.util.List<T> toList()
SequenceSequence into a List.public <U extends java.util.Collection<T>> U collectInto(U collection)
SequenceSequence into the given Collection.collectInto in interface Sequence<T>public void clear()
clear in interface java.util.Collection<T>clear in interface java.util.List<T>clear in interface IterableCollection<T>clear in interface IterableList<T>public int size()
size in interface java.util.Collection<T>size in interface java.util.List<T>size in interface IterableCollection<T>size in interface IterableList<T>public java.util.stream.Stream<T> stream()
stream in interface java.util.Collection<T>public boolean isEmpty()
isEmpty in interface java.util.Collection<T>isEmpty in interface java.util.List<T>isEmpty in interface IterableCollection<T>isEmpty in interface IterableList<T>public boolean contains(java.lang.Object item)
contains in interface java.util.Collection<T>contains in interface java.util.List<T>contains in interface IterableCollection<T>contains in interface IterableList<T>public java.util.Optional<T> at(int index)
public java.util.Optional<T> last()
public Sequence<T> filter(java.util.function.Predicate<? super T> predicate)
SequenceSequence, keeping only the elements that match the given Predicate.public <U> Sequence<U> map(java.util.function.Function<? super T,? extends U> mapper)
SequenceSequence to another set of values specified by the given mapper function.map in interface Sequence<T>Sequence.mapIndexed(ObjIntFunction),
Sequence.mapBack(BiFunction),
Sequence.mapForward(BiFunction),
Sequence.flatten(),
Sequence.flatten(Function),
Sequence.toChars(ToCharFunction),
Sequence.toInts(ToIntFunction),
Sequence.toLongs(ToLongFunction),
Sequence.toDoubles(ToDoubleFunction)public Sequence<T> append(java.lang.Iterable<T> iterable)
SequenceIterable to the end of this Sequence.append in interface Sequence<T>Sequence.cache(Iterable)