|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection java.util.AbstractList groovy.lang.IntRange
public class IntRange extends java.util.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.
Method Summary | |
---|---|
java.lang.Object
|
IntRange(int from, int to)
Creates a new |
protected java.lang.Object
|
IntRange(int from, int to, boolean reverse)
Creates a new |
boolean
|
contains(java.lang.Object value)
{@inheritDoc} |
boolean
|
containsAll(java.util.Collection other)
{@inheritDoc} |
boolean
|
containsWithinBounds(java.lang.Object o)
|
boolean
|
equals(java.lang.Object that)
Determines if this object is equal to another object. |
boolean
|
equals(IntRange that)
|
java.lang.Integer
|
get(int index)
{@inheritDoc} |
java.lang.Comparable
|
getFrom()
{@inheritDoc} |
int
|
getFromInt()
Gets the 'from' value as an integer. |
java.lang.Comparable
|
getTo()
{@inheritDoc} |
int
|
getToInt()
Gets the 'to' value as an integer. |
java.lang.String
|
inspect()
{@inheritDoc} |
boolean
|
isReverse()
{@inheritDoc} |
java.util.Iterator
|
iterator()
{@inheritDoc} |
int
|
size()
{@inheritDoc} |
void
|
step(int step, Closure closure)
{@inheritDoc} |
java.util.List
|
step(int step)
{@inheritDoc} |
java.util.List
|
subList(int fromIndex, int toIndex)
{@inheritDoc} |
java.lang.String
|
toString()
{@inheritDoc} |
Methods inherited from class java.util.AbstractList | |
---|---|
java.util.AbstractList#add(java.lang.Object), java.util.AbstractList#add(int, java.lang.Object), java.util.AbstractList#get(int), java.util.AbstractList#equals(java.lang.Object), java.util.AbstractList#hashCode(), java.util.AbstractList#indexOf(java.lang.Object), java.util.AbstractList#clear(), java.util.AbstractList#lastIndexOf(java.lang.Object), java.util.AbstractList#subList(int, int), java.util.AbstractList#remove(int), java.util.AbstractList#addAll(int, java.util.Collection), java.util.AbstractList#iterator(), java.util.AbstractList#set(int, java.lang.Object), java.util.AbstractList#listIterator(), java.util.AbstractList#listIterator(int), java.util.AbstractList#toString(), java.util.AbstractList#size(), java.util.AbstractList#isEmpty(), java.util.AbstractList#contains(java.lang.Object), java.util.AbstractList#toArray(), java.util.AbstractList#toArray([Ljava.lang.Object;), java.util.AbstractList#remove(java.lang.Object), java.util.AbstractList#addAll(java.util.Collection), java.util.AbstractList#containsAll(java.util.Collection), java.util.AbstractList#removeAll(java.util.Collection), java.util.AbstractList#retainAll(java.util.Collection), java.util.AbstractList#wait(long), java.util.AbstractList#wait(long, int), java.util.AbstractList#wait(), java.util.AbstractList#getClass(), java.util.AbstractList#notify(), java.util.AbstractList#notifyAll(), java.util.AbstractList#size() |
Methods inherited from class java.util.AbstractCollection | |
---|---|
java.util.AbstractCollection#add(java.lang.Object), java.util.AbstractCollection#toString(), java.util.AbstractCollection#clear(), java.util.AbstractCollection#size(), java.util.AbstractCollection#isEmpty(), java.util.AbstractCollection#contains(java.lang.Object), java.util.AbstractCollection#toArray(), java.util.AbstractCollection#toArray([Ljava.lang.Object;), java.util.AbstractCollection#remove(java.lang.Object), java.util.AbstractCollection#addAll(java.util.Collection), java.util.AbstractCollection#iterator(), java.util.AbstractCollection#containsAll(java.util.Collection), java.util.AbstractCollection#removeAll(java.util.Collection), java.util.AbstractCollection#retainAll(java.util.Collection), java.util.AbstractCollection#wait(long), java.util.AbstractCollection#wait(long, int), java.util.AbstractCollection#wait(), java.util.AbstractCollection#equals(java.lang.Object), java.util.AbstractCollection#hashCode(), java.util.AbstractCollection#getClass(), java.util.AbstractCollection#notify(), java.util.AbstractCollection#notifyAll() |
Method Detail |
---|
public java.lang.Object IntRange(int from, int to)
IntRange
. If from
is greater
than to
, a reverse range is created with
from
and to
swapped.from
- the first number in the range.to
- the last number in the range.
protected java.lang.Object IntRange(int from, int to, boolean reverse)
IntRange
.from
is greater than to
.from
- the first value in the range.to
- the last value in the range.reverse
- true
if the range should count from
to
to from
.
public boolean contains(java.lang.Object value)
public boolean containsAll(java.util.Collection other)
public boolean containsWithinBounds(java.lang.Object o)
public boolean equals(java.lang.Object that)
that
is anything
other than an IntRange.
It is not necessary to override hashCode
, as
java.util.AbstractList#hashCode() provides a suitable hash code.Note that equals is generally handled by DefaultGroovyMethods.equals instead of this method.
that
- the object to comparetrue
if the objects are equal
public boolean equals(IntRange that)
that
- the object to compare for equalitytrue
if the ranges are equal
public java.lang.Integer get(int index)
public java.lang.Comparable getFrom()
public int getFromInt()
public java.lang.Comparable getTo()
public int getToInt()
public java.lang.String inspect()
public boolean isReverse()
public java.util.Iterator iterator()
public int size()
public void step(int step, Closure closure)
public java.util.List step(int step)
public java.util.List subList(int fromIndex, int toIndex)
public java.lang.String toString()
Groovy Documentation