Package io.jenetics.util
Interface BaseSeq<T>
-
- All Superinterfaces:
Iterable<T>,RandomAccess
- All Known Subinterfaces:
BoundedChromosome<A,G>,Chromosome<G>,ISeq<T>,MSeq<T>,NumericChromosome<N,G>,Seq<T>
- All Known Implementing Classes:
AbstractChromosome,AnyChromosome,ArrayISeq,ArraySeq,BitChromosome,CharacterChromosome,CharSeq,DoubleChromosome,Genotype,IntegerChromosome,LongChromosome,PermutationChromosome
public interface BaseSeq<T> extends Iterable<T>, RandomAccess
General base interface for a ordered, fixed sized, object sequence.- Since:
- 5.2
- Version:
- 5.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidforEach(Consumer<? super T> action)Tget(int index)Return the value at the givenindex.default booleanisEmpty()Returnstrueif this sequence contains no elements.default Iterator<T>iterator()intlength()Return the length of this sequence.default ListIterator<T>listIterator()Returns a list iterator over the elements in this sequence (in proper order).default booleannonEmpty()Returnstrueif this sequence contains at least one element.default Spliterator<T>spliterator()default Stream<T>stream()Returns a sequential Stream with this sequence as its source.
-
-
-
Method Detail
-
get
T get(int index)
Return the value at the givenindex.- Parameters:
index- index of the element to return.- Returns:
- the value at the given
index. - Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size()).
-
length
int length()
Return the length of this sequence. Once the sequence is created, the length can't be changed.- Returns:
- the length of this sequence.
-
isEmpty
default boolean isEmpty()
Returnstrueif this sequence contains no elements.- Returns:
trueif this sequence contains no elements- Since:
- 6.0
-
nonEmpty
default boolean nonEmpty()
Returnstrueif this sequence contains at least one element.- Returns:
trueif this sequence contains at least one element- Since:
- 6.0
-
listIterator
default ListIterator<T> listIterator()
Returns a list iterator over the elements in this sequence (in proper order).- Returns:
- a list iterator over the elements in this sequence (in proper order)
-
stream
default Stream<T> stream()
Returns a sequential Stream with this sequence as its source.- Returns:
- a sequential Stream over the elements in this sequence
-
spliterator
default Spliterator<T> spliterator()
- Specified by:
spliteratorin interfaceIterable<T>
-
-