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>, TreeChromosome<A,G>
All Known Implementing Classes:
AbstractChromosome, AbstractTreeChromosome, AnyChromosome, io.jenetics.internal.collection.ArrayISeq, io.jenetics.internal.collection.ArraySeq, BigIntegerChromosome, BitChromosome, CharacterChromosome, CharSeq, DoubleChromosome, Genotype, IntegerChromosome, LongChromosome, PermutationChromosome, ProgramChromosome

public interface BaseSeq<T> extends Iterable<T>, RandomAccess
General base interface for an ordered, fixed sized, object sequence.
Since:
5.2
Version:
5.2
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    forEach(Consumer<? super T> action)
     
    get(int index)
    Return the value at the given index.
    default boolean
    Returns true if this sequence contains no elements.
    default Iterator<T>
     
    int
    Return the length of this sequence.
    default ListIterator<T>
    Returns a list iterator over the elements in this sequence (in proper order).
    default boolean
    Returns true if this sequence contains at least one element.
    default Spliterator<T>
     
    default Stream<T>
    Returns a sequential Stream with this sequence as its source.
  • Method Details

    • get

      T get(int index)
      Return the value at the given index.
      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()
      Returns true if this sequence contains no elements.
      Returns:
      true if this sequence contains no elements
      Since:
      6.0
    • nonEmpty

      default boolean nonEmpty()
      Returns true if this sequence contains at least one element.
      Returns:
      true if this sequence contains at least one element
      Since:
      6.0
    • forEach

      default void forEach(Consumer<? super T> action)
      Specified by:
      forEach in interface Iterable<T>
    • iterator

      default Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<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

      Specified by:
      spliterator in interface Iterable<T>