|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
java.lang.Iterable groovy.lang.Range java.util.Collection
public interface Range extends java.util.List
A Range represents the list of all items obtained by starting from a
from
value and calling next()
successively
until you reach the to
value. For a reverse range,
the list is obtained by starting at the to
value and
successively calling previous()
until the from
value is reached.
Method Summary | |
---|---|
boolean
|
containsWithinBounds(java.lang.Object o)
Indicates whether an object is greater than or equal to the |
java.lang.Comparable
|
getFrom()
The lower value in the range. |
java.lang.Comparable
|
getTo()
The upper value in the range. |
java.lang.String
|
inspect()
@return the verbose java.lang.String representation of this Range as would be typed into a console to create the Range instance |
boolean
|
isReverse()
Indicates whether this is a reverse range which iterates backwards starting from the to value and ending on the from value |
void
|
step(int step, Closure closure)
Steps through the range, calling a closure for each number. |
java.util.List
|
step(int step)
Forms a list by stepping through the range by the indicated interval. |
Methods inherited from interface java.util.List | |
---|---|
java.util.List#add(java.lang.Object), java.util.List#add(int, java.lang.Object), java.util.List#get(int), java.util.List#equals(java.lang.Object), java.util.List#hashCode(), java.util.List#indexOf(java.lang.Object), java.util.List#clear(), java.util.List#size(), java.util.List#isEmpty(), java.util.List#lastIndexOf(java.lang.Object), java.util.List#contains(java.lang.Object), java.util.List#subList(int, int), java.util.List#toArray(), java.util.List#toArray([Ljava.lang.Object;), java.util.List#remove(java.lang.Object), java.util.List#remove(int), java.util.List#addAll(java.util.Collection), java.util.List#addAll(int, java.util.Collection), java.util.List#iterator(), java.util.List#set(int, java.lang.Object), java.util.List#containsAll(java.util.Collection), java.util.List#removeAll(java.util.Collection), java.util.List#retainAll(java.util.Collection), java.util.List#listIterator(), java.util.List#listIterator(int) |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Method Detail |
---|
public boolean containsWithinBounds(java.lang.Object o)
from
value for the range and less than or equal to the to
value.
o
- the object to check against the boundaries of the rangetrue
if the object is between the from and to values
public java.lang.Comparable getFrom()
public java.lang.Comparable getTo()
public java.lang.String inspect()
public boolean isReverse()
true
if this is a reverse range
public void step(int step, Closure closure)
step
- the amount by which to step. If negative, steps through the
range backwards.closure
- the Closure to call
public java.util.List step(int step)
step
- the amount by which to step. If negative, steps through the
range backwards.
Groovy Documentation