public class EmptyRange extends AbstractList implements Range
Modifier and Type | Field and Description |
---|---|
protected Comparable |
at
The value at which the range originates (may be
null ). |
modCount
Constructor and Description |
---|
EmptyRange(Comparable at)
Creates a new
EmptyRange . |
Modifier and Type | Method and Description |
---|---|
boolean |
add(Object o)
Always throws
UnsupportedOperationException for an empty range. |
boolean |
addAll(Collection c)
Always throws
UnsupportedOperationException for an empty range. |
boolean |
addAll(int index,
Collection c)
Always throws
UnsupportedOperationException for an empty range. |
boolean |
containsWithinBounds(Object o)
Never true for an empty range.
|
Object |
get(int index)
Always throws
IndexOutOfBoundsException for an empty range. |
Comparable |
getFrom()
The lower value in the range.
|
Comparable |
getTo()
The upper value in the range.
|
String |
inspect() |
boolean |
isReverse()
Never true for an empty range.
|
Object |
remove(int index)
Always throws
UnsupportedOperationException for an empty range. |
boolean |
remove(Object o)
Always throws
UnsupportedOperationException for an empty range. |
boolean |
removeAll(Collection c)
Always throws
UnsupportedOperationException for an empty range. |
boolean |
retainAll(Collection c)
Always throws
UnsupportedOperationException for an empty range. |
Object |
set(int index,
Object element)
Always throws
UnsupportedOperationException for an empty range. |
int |
size()
Always 0 for an empty range.
|
List |
step(int step)
Always returns an empty list for an empty range.
|
void |
step(int step,
Closure closure)
Always does nothing for an empty range.
|
String |
toString() |
add, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
contains, containsAll, isEmpty, toArray, toArray
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, subList, toArray, toArray
protected Comparable at
null
).public EmptyRange(Comparable at)
EmptyRange
.at
- the value at which the range starts (may be null
).public Comparable getFrom()
public Comparable getTo()
public boolean isReverse()
public boolean containsWithinBounds(Object o)
containsWithinBounds
in interface Range
o
- the object to check against the boundaries of the rangefalse
public String inspect()
public String toString()
toString
in class AbstractCollection
public int size()
size
in interface Collection
size
in interface List
size
in class AbstractCollection
public Object get(int index)
IndexOutOfBoundsException
for an empty range.get
in interface List
get
in class AbstractList
IndexOutOfBoundsException
- alwayspublic boolean add(Object o)
UnsupportedOperationException
for an empty range.add
in interface Collection
add
in interface List
add
in class AbstractList
UnsupportedOperationException
- alwayspublic boolean addAll(int index, Collection c)
UnsupportedOperationException
for an empty range.addAll
in interface List
addAll
in class AbstractList
UnsupportedOperationException
public boolean addAll(Collection c)
UnsupportedOperationException
for an empty range.addAll
in interface Collection
addAll
in interface List
addAll
in class AbstractCollection
UnsupportedOperationException
public boolean remove(Object o)
UnsupportedOperationException
for an empty range.remove
in interface Collection
remove
in interface List
remove
in class AbstractCollection
UnsupportedOperationException
public Object remove(int index)
UnsupportedOperationException
for an empty range.remove
in interface List
remove
in class AbstractList
UnsupportedOperationException
public boolean removeAll(Collection c)
UnsupportedOperationException
for an empty range.removeAll
in interface Collection
removeAll
in interface List
removeAll
in class AbstractCollection
UnsupportedOperationException
public boolean retainAll(Collection c)
UnsupportedOperationException
for an empty range.retainAll
in interface Collection
retainAll
in interface List
retainAll
in class AbstractCollection
UnsupportedOperationException
public Object set(int index, Object element)
UnsupportedOperationException
for an empty range.set
in interface List
set
in class AbstractList
UnsupportedOperationException
public void step(int step, Closure closure)