Package ste.lloop

Class ArraySequence<T>

Type Parameters:
T - the type of the elements in the array

public class ArraySequence<T> extends IndexedSequence<T>
A sequence that loops over an array.
  • Constructor Details

    • ArraySequence

      public ArraySequence(T[] array)
      Creates a new sequence for the given array.
      Parameters:
      array - the array to loop over
  • Method Details

    • loop

      public <R> R loop(BiConsumer<Integer,T> consumer)
      Description copied from class: IndexedSequence
      Executes the given consumer for each element in the loop.

      If the array provided to the constructor was null, this method will do nothing.

      Specified by:
      loop in class IndexedSequence<T>
      Type Parameters:
      R - the type of the return value
      Parameters:
      consumer - the consumer to execute for each element
      Returns:
      the value passed to Loop.brk(Object), or null if the loop completes without a brk