public class ObjectRange extends AbstractList<Comparable> implements Range<Comparable>
modCount| Constructor and Description | 
|---|
| ObjectRange(Comparable from,
           Comparable to)Creates a new  ObjectRange. | 
| ObjectRange(Comparable smaller,
           Comparable larger,
           boolean reverse)Creates a new  ObjectRangeassumes smaller <= larger, else behavior is undefined. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected void | checkBoundaryCompatibility()throws IllegalArgumentException if to and from are incompatible, meaning they e.g. | 
| protected int | compareTo(Comparable first,
         Comparable second) | 
| boolean | contains(Object value)Iterates over all values and returns true if one value matches. | 
| boolean | containsWithinBounds(Object value)Checks whether a value is between the from and to values of a Range | 
| protected Object | decrement(Object value)Decrements by one | 
| boolean | equals(Object that) | 
| boolean | equals(ObjectRange that)Compares an  ObjectRangeto anotherObjectRange. | 
| Comparable | get(int index) | 
| Comparable | getFrom()The lower value in the range. | 
| Comparable | getTo()The upper value in the range. | 
| protected Object | increment(Object value)Increments by one | 
| String | inspect() | 
| boolean | isReverse()Indicates whether this is a reverse range which iterates backwards
 starting from the to value and ending on the from value | 
| Iterator<Comparable> | iterator() | 
| int | size() | 
| List<Comparable> | step(int step)Forms a list by stepping through the range by the indicated interval. | 
| void | step(int step,
    Closure closure)Steps through the range, calling a closure for each item. | 
| List<Comparable> | subList(int fromIndex,
       int toIndex) | 
| String | toString() | 
add, add, addAll, clear, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, setaddAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, add, addAll, addAll, clear, containsAll, hashCode, indexOf, isEmpty, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, toArray, toArrayparallelStream, removeIf, streampublic ObjectRange(Comparable from, Comparable to)
from - the first value in the range.to - the last value in the range.public ObjectRange(Comparable smaller, Comparable larger, boolean reverse)
ObjectRange assumes smaller <= larger, else behavior is undefined.
 Caution: Prefer the other constructor when in doubt.
 Optimized Constructor avoiding initial computation of comparison.
protected void checkBoundaryCompatibility()
public boolean equals(Object that)
equals in interface Collection<Comparable>equals in interface List<Comparable>equals in class AbstractList<Comparable>public boolean equals(ObjectRange that)
ObjectRange to another ObjectRange.that - the object to check equality withtrue if the ranges are equalpublic Comparable getFrom()
RangegetFrom in interface Range<Comparable>public Comparable getTo()
RangegetTo in interface Range<Comparable>public boolean isReverse()
RangeisReverse in interface Range<Comparable>true if this is a reverse rangepublic Comparable get(int index)
get in interface List<Comparable>get in class AbstractList<Comparable>public boolean containsWithinBounds(Object value)
containsWithinBounds in interface Range<Comparable>value - the value of interestprotected int compareTo(Comparable first, Comparable second)
public int size()
size in interface Collection<Comparable>size in interface List<Comparable>size in class AbstractCollection<Comparable>public List<Comparable> subList(int fromIndex, int toIndex)
subList in interface List<Comparable>subList in class AbstractList<Comparable>public String toString()
toString in class AbstractCollection<Comparable>public String inspect()
public boolean contains(Object value)
contains in interface Collection<Comparable>contains in interface List<Comparable>contains in class AbstractCollection<Comparable>containsWithinBounds(Object)public void step(int step,
                 Closure closure)
Rangestep in interface Range<Comparable>step - the amount by which to step. If negative, steps through the range backwards.closure - the Closure to callpublic Iterator<Comparable> iterator()
iterator in interface Iterable<Comparable>iterator in interface Collection<Comparable>iterator in interface List<Comparable>iterator in class AbstractList<Comparable>public List<Comparable> step(int step)
Rangestep in interface Range<Comparable>step - the amount by which to step. If negative, steps through the range backwards.protected Object increment(Object value)
value - the value to increment