Modifier and Type | Field and Description |
---|---|
static ISeq<?> |
EMPTY
Single instance of an empty
ISeq . |
Modifier and Type | Method and Description |
---|---|
ISeq<T> |
append(Iterable<? extends T> values)
Return a new
Seq with the given values appended. |
default ISeq<T> |
append(T... values)
Return a new
Seq with the given values appended. |
MSeq<T> |
copy()
Return a shallow copy of this sequence.
|
static <T> ISeq<T> |
empty()
Return an empty
ISeq . |
<B> ISeq<B> |
map(Function<? super T,? extends B> mapper)
Builds a new sequence by applying a function to all elements of this
sequence.
|
static <T> ISeq<T> |
of(Iterable<? extends T> values)
Create a new
ISeq from the given values. |
static <T> ISeq<T> |
of(Supplier<? extends T> supplier,
int length)
Creates a new sequence, which is filled with objects created be the given
supplier . |
static <T> ISeq<T> |
of(T... values)
Create a new
ISeq from the given values. |
ISeq<T> |
prepend(Iterable<? extends T> values)
Return a new
Seq with the given values prepended. |
default ISeq<T> |
prepend(T... values)
Return a new
Seq with the given values prepended. |
ISeq<T> |
subSeq(int start)
Returns a view of the portion of this sequence between the specified
start , inclusive, and end , exclusive. |
ISeq<T> |
subSeq(int start,
int end)
Returns a view of the portion of this sequence between the specified
start , inclusive, and end , exclusive. |
static <T> Collector<T,?,ISeq<T>> |
toISeq()
Returns a
Collector that accumulates the input elements into a
new ISeq . |
static <A,B extends A> |
upcast(ISeq<B> seq)
Allows a safe (without compile warning) upcast from
B to
A . |
apply, asISeq, asList, asMSeq, contains, equals, equals, forAll, get, hashCode, hashCode, indexOf, indexOf, indexOf, indexWhere, indexWhere, indexWhere, isEmpty, isSorted, isSorted, iterator, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexWhere, lastIndexWhere, lastIndexWhere, length, listIterator, nonEmpty, parallelStream, size, spliterator, stream, toArray, toArray, toSeq, toString, toString
ISeq<T> subSeq(int start, int end)
Seq
start
, inclusive, and end
, exclusive. (If start
and end
are equal, the returned sequence has the length zero.)
The returned sequence is backed by this sequence, so non-structural
changes in the returned sequence are reflected in this array, and
vice-versa.
This method eliminates the need for explicit range operations (of the populationSort that commonly exist for arrays). Any operation that expects an array can be used as a range operation by passing an sub sequence view instead of an whole sequence.
ISeq<T> subSeq(int start)
Seq
start
, inclusive, and end
, exclusive. (If start
and end
are equal, the returned sequence has the length zero.)
The returned sequence is backed by this sequence, so non-structural
changes in the returned sequence are reflected in this sequence, and
vice-versa.
This method eliminates the need for explicit range operations (of the populationSort that commonly exist for arrays). Any operation that expects an sequence can be used as a range operation by passing an sub sequence view instead of an whole sequence.
<B> ISeq<B> map(Function<? super T,? extends B> mapper)
Seq
map
in interface Seq<T>
B
- the element type of the returned collection.mapper
- the function to apply to each element.default ISeq<T> append(T... values)
Seq
Seq
with the given values
appended.ISeq<T> append(Iterable<? extends T> values)
Seq
Seq
with the given values
appended.default ISeq<T> prepend(T... values)
Seq
Seq
with the given values
prepended.ISeq<T> prepend(Iterable<? extends T> values)
Seq
Seq
with the given values
prepended.static <T> Collector<T,?,ISeq<T>> toISeq()
Collector
that accumulates the input elements into a
new ISeq
.T
- the type of the input elementsCollector
which collects all the input elements into an
ISeq
, in encounter order@SafeVarargs static <T> ISeq<T> of(T... values)
ISeq
from the given values.of
in interface Seq<T>
T
- the element typevalues
- the array values.ISeq
with the given values.NullPointerException
- if the values
array is null
.static <T> ISeq<T> of(Iterable<? extends T> values)
ISeq
from the given values.of
in interface Seq<T>
T
- the element typevalues
- the array values.ISeq
with the given values.NullPointerException
- if the values
array is null
.static <T> ISeq<T> of(Supplier<? extends T> supplier, int length)
supplier
.of
in interface Seq<T>
T
- the element type of the sequencesupplier
- the Supplier
which creates the elements, the
returned sequence is filled withlength
- the length of the returned sequencesupplier
NegativeArraySizeException
- if the given length
is
negativeNullPointerException
- if the given supplier
is
null
static <A,B extends A> ISeq<A> upcast(ISeq<B> seq)
B
to
A
. Since ISeq
instances are immutable, an upcast
will be always safe.
// The sequence which we want to case.
final ISeq<? extends Number> ints = ISeq.of(1, 2, 3, 4, 5);
// This casts are possible without warning.
final ISeq<Object> objects = ISeq.upcast(ints);
final ISeq<Number> numbers = ISeq.upcast(ints);
// This cast will, of course, still fail.
final ISeq<String> strings = ISeq.upcast(ints);
final ISeq<Integer> integers = ISeq.upcast(ints);
A
- the super-object typeB
- the sub-object typeseq
- the sequence to cast safelyseq
© 2007-2017 Franz Wilhelmstötter (2017-11-16 19:35)