Class BreakableSpliterator<E>

Type Parameters:
E - the element type.
All Implemented Interfaces:
Spliterator<E>, Breakable, SupportedMethods

public class BreakableSpliterator<E> extends AbstractBreakable implements Spliterator<E>

An Spliterator that can be broken in well-defined ways in order to test collection utilities or testing classes.

Breaks

The breaks that are supported for this class are listed in the description of the method that they impact.

Any breaks that are not listed in this class can be added to an instance of BreakableSpliterator, but will not have any impact on how it functions.

Since:
1.0
Author:
evanbergstrom
See Also:
  • Field Details

    • SPLITERATOR_IS_ALWAYS_EMPTY

      public static final Break SPLITERATOR_IS_ALWAYS_EMPTY
      The spliterator always has no elements.
    • SPLITERATOR_SKIPS_FIRST_ELEMENT

      public static final Break SPLITERATOR_SKIPS_FIRST_ELEMENT
      The spliterator that skips the first element.
    • SPLITERATOR_FOR_EACH_REMAINING_DOES_NOT_CALL_ACTION

      public static final Break SPLITERATOR_FOR_EACH_REMAINING_DOES_NOT_CALL_ACTION
      The 'forEachRemaining' method on the spliterator does not call the action.
      See Also:
    • SPLITERATOR_TRY_SPLIT_ALWAYS_RETURNS_NULL

      public static final Break SPLITERATOR_TRY_SPLIT_ALWAYS_RETURNS_NULL
      The 'trySplit' method on the spliterator always returns null.
      See Also:
    • SPLITERATOR_TRY_ADVANCE_DOES_NOT_CALL_ACTION

      public static final Break SPLITERATOR_TRY_ADVANCE_DOES_NOT_CALL_ACTION
      The 'tryAdvance' method on the spliterator does not call the action.
      See Also:
    • SPLITERATOR_TRY_ADVANCE_ALWAYS_RETURNS_TRUE

      public static final Break SPLITERATOR_TRY_ADVANCE_ALWAYS_RETURNS_TRUE
      The 'tryAdvance' method always returns true.
      See Also:
    • SPLITERATOR_TRY_ADVANCE_ALWAYS_RETURNS_FALSE

      public static final Break SPLITERATOR_TRY_ADVANCE_ALWAYS_RETURNS_FALSE
      The 'tryAdvance' method always returns false.
      See Also:
    • SPLITERATOR_ESTIMATE_SIZE_ALWAYS_RETURNS_MAX_VALUE

      public static final Break SPLITERATOR_ESTIMATE_SIZE_ALWAYS_RETURNS_MAX_VALUE
      The estimateSize method always returns the max value.
      See Also:
    • SPLITERATOR_ESTIMATE_SIZE_ALWAYS_RETURNS_ZERO

      public static final Break SPLITERATOR_ESTIMATE_SIZE_ALWAYS_RETURNS_ZERO
      The estimateSize method always returns zero.
      See Also:
    • SPLITERATOR_GET_EXACT_SIZE_IF_KNOWN_ALWAYS_RETURNS_NEGATIVE_ONE

      public static final Break SPLITERATOR_GET_EXACT_SIZE_IF_KNOWN_ALWAYS_RETURNS_NEGATIVE_ONE
      The getExactSizeIfKnown method always returns negative one (-1).
      See Also:
    • SPLITERATOR_CHARACTERISTICS_ALWAYS_RETURNS_ZERO

      public static final Break SPLITERATOR_CHARACTERISTICS_ALWAYS_RETURNS_ZERO
      The characteristics method always returns zero (0).
      See Also:
    • SPLITERATOR_HAS_CHARACTERISTIC_ALWAYS_RETURNS_TRUE

      public static final Break SPLITERATOR_HAS_CHARACTERISTIC_ALWAYS_RETURNS_TRUE
      The hasCharacteristics method always returns true.
      See Also:
    • SPLITERATOR_HAS_CHARACTERISTIC_ALWAYS_RETURNS_FALSE

      public static final Break SPLITERATOR_HAS_CHARACTERISTIC_ALWAYS_RETURNS_FALSE
      The hasCharacteristics method always returns false.
      See Also:
    • SPLITERATOR_GET_COMPARATOR_ALWAYS_RETURNS_NULL

      public static final Break SPLITERATOR_GET_COMPARATOR_ALWAYS_RETURNS_NULL
      The getComparator method always return null.
      See Also:
  • Constructor Details

    • BreakableSpliterator

      public BreakableSpliterator(Spliterator<E> iterator, Collection<Break> breaks, int characteristics)
      Constructs a breakable spliterator from a spliterator that will provide the implementation.
      Parameters:
      iterator - The spliterator that will provide the implementation
      breaks - The breaks that define how the iterator is broken.
      characteristics - A mask that indicates the characteristics of the iterator.
  • Method Details