Class RangeSet.SubIter

java.lang.Object
RangeSet<E>.Iter
org.apache.sis.util.collection.RangeSet.SubIter
All Implemented Interfaces:
Iterator<Range<E>>
Enclosing class:
RangeSet<E extends Comparable<? super E>>

private final class RangeSet.SubIter extends RangeSet<E>.Iter
The iterator returned by RangeSet.SubSet.iterator(). This iterator is similar to the one returned by RangeSet.iterator(), except that:
  • The iteration is restricted to a sub-region of the RangeSet.array.
  • The first and last ranges returned by the iterator are intercepted with the range of the subset (other ranges should not need to be intercepted).
  • The range removed by remove() is intercepted with the range of the subset.
Since:
0.3
Version:
0.3
  • Field Details

  • Constructor Details

    • SubIter

      SubIter(Range<E> subRange, int lower, int upper)
      Creates a new iterator for the given portion of the RangeSet.array.
  • Method Details

    • isFirstOrLast

      private boolean isFirstOrLast()
      Returns true if the iterator position is at the first or at the last range. This method is accurate only when invoked after super.next().
    • next

      public Range<E> next()
      Returns the next element in the iteration.
      Specified by:
      next in interface Iterator<Range<E extends Comparable<? super E>>>
      Overrides:
      next in class RangeSet<E extends Comparable<? super E>>.Iter
    • remove

      public void remove()
      Removes from the underlying collection the last element returned by the iterator.
      Specified by:
      remove in interface Iterator<Range<E extends Comparable<? super E>>>
      Overrides:
      remove in class RangeSet<E extends Comparable<? super E>>.Iter