Class CharacterSequence


public class CharacterSequence extends IndexedSequence<Character>
A sequence that loops over a CharSequence. Note that we do not reuse ArraySequence to work directly on the sequence itself, not on char[] extracted from it.
  • Constructor Details

    • CharacterSequence

      public CharacterSequence(CharSequence sequence)
      Creates a new sequence for the given CharSequence.
      Parameters:
      sequence - the CharSequence to loop over
  • Method Details

    • loop

      public <R> R loop(BiConsumer<Integer, Character> 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<Character>
      Type Parameters:
      R - the type of the return value
      Parameters:
      consumer - the consumer to execute for each element
      Returns:
      the value passed to Loop._break_(Object...), or null if the loop completes without a _break_