Class NumberSequenceIterator

  • All Implemented Interfaces:
    Serializable, Iterator<Long>

    @Public
    public class NumberSequenceIterator
    extends SplittableIterator<Long>
    The NumberSequenceIterator is an iterator that returns a sequence of numbers (as Long)s. The iterator is splittable (as defined by SplittableIterator, i.e., it can be divided into multiple iterators that each return a subsequence of the number sequence.
    See Also:
    Serialized Form
    • Constructor Detail

      • NumberSequenceIterator

        public NumberSequenceIterator​(long from,
                                      long to)
        Creates a new splittable iterator, returning the range [from, to]. Both boundaries of the interval are inclusive.
        Parameters:
        from - The first number returned by the iterator.
        to - The last number returned by the iterator.
    • Method Detail

      • getCurrent

        public long getCurrent()
      • getTo

        public long getTo()
      • hasNext

        public boolean hasNext()
      • next

        public Long next()
      • remove

        public void remove()
      • split

        public NumberSequenceIterator[] split​(int numPartitions)
        Description copied from class: SplittableIterator
        Splits this iterator into a number disjoint iterators. The union of these iterators returns the original iterator values.
        Specified by:
        split in class SplittableIterator<Long>
        Parameters:
        numPartitions - The number of iterators to split into.
        Returns:
        An array with the split iterators.
      • getMaximumNumberOfSplits

        public int getMaximumNumberOfSplits()
        Description copied from class: SplittableIterator
        The maximum number of splits into which this iterator can be split up.
        Specified by:
        getMaximumNumberOfSplits in class SplittableIterator<Long>
        Returns:
        The maximum number of splits into which this iterator can be split up.