|
Groovy 2.2.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD |
groovy.lang.Range java.lang.Iterable java.util.Collection
public interface Range extends 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(Object o)
Indicates whether an object is greater than or equal to the |
Object
|
getFrom()
The lower value in the range. |
Object
|
getTo()
The upper value in the range. |
String
|
inspect()
@return the verbose 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. |
List
|
step(int step)
Forms a list by stepping through the range by the indicated interval. |
Methods inherited from interface List | |
---|---|
add, add, remove, remove, get, equals, hashCode, indexOf, clear, contains, isEmpty, lastIndexOf, size, subList, toArray, toArray, addAll, addAll, iterator, set, retainAll, containsAll, listIterator, listIterator, removeAll |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Method Detail |
---|
public boolean containsWithinBounds(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 Object getFrom()
public Object getTo()
public 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 List step(int step)
step
- the amount by which to step. If negative, steps through the
range backwards.
Copyright © 2003-2013 The Codehaus. All rights reserved.