Interface Sequence<T>


public interface Sequence<T>
  • Method Summary

    Modifier and Type
    Method
    Description
    cons(T item, Sequence<T> sequence)
    Construct a new immutable list by adding the new front item to the existing sequence.
    Return the first element of the sequence.
    Return the rest of the sequence without the first item of the sequence.
  • Method Details

    • first

      @Contract(pure=true) T first()
      Return the first element of the sequence.
      Returns:
      first element of the sequence if defined otherwise Nil
    • rest

      @Contract(pure=true) Sequence<T> rest()
      Return the rest of the sequence without the first item of the sequence.
      Returns:
      rest of the sequence, it can be empty
    • cons

      @Contract(pure=true) Sequence<T> cons(T item, Sequence<T> sequence)
      Construct a new immutable list by adding the new front item to the existing sequence.
      Parameters:
      item - item to add to the sequence
      sequence - sequence where the item will be added in the front of the sequence
      Returns:
      new immutable list