|
Groovy 1.8.4 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection
java.util.AbstractList
groovy.lang.IntRange
public 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.
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)
{@inheritDoc} |
boolean
|
containsAll(Collection other)
{@inheritDoc} |
boolean
|
containsWithinBounds(Object o)
|
boolean
|
equals(Object that)
Determines if this object is equal to another object. |
boolean
|
equals(IntRange that)
|
Integer
|
get(int index)
{@inheritDoc} |
Comparable
|
getFrom()
{@inheritDoc} |
int
|
getFromInt()
Gets the 'from' value as an integer. |
Comparable
|
getTo()
{@inheritDoc} |
int
|
getToInt()
Gets the 'to' value as an integer. |
String
|
inspect()
{@inheritDoc} |
boolean
|
isReverse()
{@inheritDoc} |
Iterator
|
iterator()
{@inheritDoc} |
int
|
size()
{@inheritDoc} |
void
|
step(int step, Closure closure)
{@inheritDoc} |
List
|
step(int step)
{@inheritDoc} |
List
|
subList(int fromIndex, int toIndex)
{@inheritDoc} |
String
|
toString()
{@inheritDoc} |
Methods inherited from class AbstractList | |
---|---|
add, add, get, equals, hashCode, indexOf, clear, lastIndexOf, subList, addAll, iterator, remove, set, listIterator, listIterator, toString, contains, isEmpty, size, toArray, toArray, addAll, remove, containsAll, removeAll, retainAll, wait, wait, wait, getClass, notify, notifyAll, size |
Methods inherited from class AbstractCollection | |
---|---|
add, toString, clear, contains, isEmpty, size, toArray, toArray, addAll, iterator, remove, containsAll, removeAll, retainAll, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll |
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.from
- the first number in the range.to
- the last number in the range.
protected def 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(Object value)
public boolean containsAll(Collection other)
public boolean containsWithinBounds(Object o)
public boolean equals(Object that)
that
is anything
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.
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 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-2011 The Codehaus. All rights reserved.