|
Groovy 1.7.0 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
groovy.lang.IntRange
class IntRange extends AbstractList
Represents a list of Integer objects from a specified int up (or down) to and including a given to.
This class is a copy of ObjectRange optimized for
int
. If you make any
changes to this class, you might consider making parallel changes to ObjectRange.
Nested Class Summary | |
---|---|
class |
IntRange.IntRangeIterator
Iterates through each number in an |
Constructor Summary | |
IntRange()
|
Method Summary | |
---|---|
def
|
IntRange(int from, int to)
Creates a new |
protected def
|
IntRange(int from, int to, boolean reverse)
Creates a new |
boolean
|
contains(Object value)
{ |
boolean
|
containsAll(Collection other)
{ |
boolean
|
containsWithinBounds(Object o)
|
boolean
|
equals(Object that)
Determines if this object is equal to another object. |
boolean
|
equals(IntRange that)
Compares an { |
Integer
|
get(int index)
{ |
Comparable
|
getFrom()
{ |
int
|
getFromInt()
Gets the 'from' value as an integer. |
Comparable
|
getTo()
{ |
int
|
getToInt()
Gets the 'to' value as an integer. |
String
|
inspect()
{ |
boolean
|
isReverse()
{ |
Iterator
|
iterator()
{ |
int
|
size()
{ |
void
|
step(int step, Closure closure)
{ |
List
|
step(int step)
{ |
List
|
subList(int fromIndex, int toIndex)
{ |
String
|
toString()
{ |
Methods inherited from class AbstractList | |
---|---|
add, add, get, hashCode, indexOf, clear, equals, lastIndexOf, addAll, iterator, remove, set, listIterator, listIterator, subList, toString, contains, isEmpty, addAll, size, toArray, toArray, remove, containsAll, removeAll, retainAll, wait, wait, wait, getClass, notify, notifyAll, size |
Methods inherited from class AbstractCollection | |
---|---|
add, clear, toString, contains, isEmpty, addAll, iterator, size, toArray, toArray, remove, containsAll, removeAll, retainAll, wait, wait, wait, hashCode, getClass, equals, notify, notifyAll |
Methods inherited from class Object | |
---|---|
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll |
Constructor Detail |
---|
IntRange()
Method Detail |
---|
public def IntRange(int from, int to)
IntRange
. If from
is greater
than to
, a reverse range is created with
from
and to
swapped.
protected def IntRange(int from, int to, boolean reverse)
IntRange
.
true
if the range should count from
to
to from
.
from
is greater than to
.
public boolean contains(Object value)
public boolean containsAll(Collection other)
public boolean containsWithinBounds(Object o)
public boolean equals(Object that)
that
is anthing
other than an IntRange.
It is not necessary to override hashCode
, as
AbstractList#hashCode() provides a suitable hash code.Note that equals is generally handled by DefaultGroovyMethods#equals instead of this method.
true
if the objects are equal
public boolean equals(IntRange that)
true
if the ranges are equal
public Integer get(int index)
public Comparable getFrom()
public int getFromInt()
public Comparable getTo()
public int getToInt()
public String inspect()
public boolean isReverse()
public Iterator iterator()
public int size()
public void step(int step, Closure closure)
public List step(int step)
public List subList(int fromIndex, int toIndex)
public String toString()
Copyright © 2003-2009 The Codehaus. All rights reserved.