Package ste.lloop

Class ListSequence<T>

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

public class ListSequence<T> extends IndexedSequence<T>
A sequence that loops over a list.
  • Constructor Details

    • ListSequence

      public ListSequence(List<T> list)
      Creates a new sequence for the given list.
      Parameters:
      list - the list 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