Package manifold.collections.api.range
Interface IterableRange<E extends Comparable<E>,S,U,ME extends IterableRange<E,S,U,ME>>
-
- All Known Implementing Classes:
AbstractIterableRange,BigDecimalRange,BigIntegerRange,DoubleRange,IntegerRange,LongRange,NumberRange,SequentialRange
public interface IterableRange<E extends Comparable<E>,S,U,ME extends IterableRange<E,S,U,ME>> extends Iterable<E>, Range<E,ME>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EgetFromLeft(int iStepIndex)EgetFromRight(int iStepIndex)SgetStep()UgetUnit()Iterator<E>iterateFromLeft()Iterator<E>iterateFromRight()Iterator<E>iterator()MEstep(S s)MEunit(U u)-
Methods inherited from interface java.lang.Iterable
count, count, distinctBy, distinctList, filterIndexedTo, filterIndexedToList, filterNotTo, filterNotToList, filterTo, filterToList, first, first, firstOrNull, firstOrNull, flatMap, flatMapTo, fold, forEach, forEachIndexed, indexOfFirst, indexOfLast, intersect, joinTo, joinToString, last, last, lastOrNull, lastOrNull, mapIndexed, mapIndexedNotNull, mapIndexedNotNullTo, mapIndexedNotNullToList, mapIndexedTo, mapIndexedToList, mapNotNull, mapNotNullTo, mapNotNullToList, mapTo, mapToList, maxWith, minWith, partition, reversed, single, single, singleOrNull, singleOrNull, spliterator, subList, subList, subtract, toList, toSet, union
-
Methods inherited from interface manifold.collections.api.range.Range
contains, contains, getLeftEndpoint, getRightEndpoint, isLeftClosed, isReversed, isRightClosed
-
-
-
-
Method Detail
-
iterator
Iterator<E> iterator()
- Specified by:
iteratorin interfaceIterable<E extends Comparable<E>>- Returns:
- An iterator that visits the elements in this range in order, from left to right. Returns null if this range does not support iteration.
- See Also:
iterateFromLeft(),iterateFromRight()
-
iterateFromLeft
Iterator<E> iterateFromLeft()
- Returns:
- An iterator that visits the elements in this range in order, from left to right. Returns null if this range does not support iteration.
- See Also:
iterator(),iterateFromRight()
-
iterateFromRight
Iterator<E> iterateFromRight()
- Returns:
- An iterator that visits the elements in this range in reverse order, from right to left. Returns null if this range does not support iteration.
- See Also:
iterator(),iterateFromLeft()
-
getStep
S getStep()
- Returns:
- The step (or increment) by which this range visits elements in its set. Returns null
if this range cannot iterate its elements.
For instance, if the range is a set of decimal values, say [1..10], the step might be a decimal increment, say 0.25. Similarly, if the range is simply a set of integers the step might also be an integer value, typically 1. Considering a date range, say [4/5/10..5/20/10], the step could be expressed in terms of a unit of time e.g., 10 seconds, 1 minute, 2 weeks, etc.
Note if non-null, the step is a positive (or absolute) increment. To iterate the range in reverse order use iterateFromRight().
-
getUnit
U getUnit()
-
getFromLeft
E getFromLeft(int iStepIndex)
- Parameters:
iStepIndex- The index of the step from the left endpoint- Returns:
- The nth step from the left endpoint. Returns null if iStepIndex is out of bounds.
-
getFromRight
E getFromRight(int iStepIndex)
- Parameters:
iStepIndex- The index of the step from the right endpoint- Returns:
- The nth step from the right endpoint. Returns null if iStepIndex is out of bounds.
-
-