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, subListcontains, containsAll, isEmpty, toArray, toArrayclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, replaceAll, sort, spliterator, subList, toArray, toArrayparallelStream, removeIf, streamprotected 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 Rangeo - the object to check against the boundaries of the rangefalsepublic String inspect()
public String toString()
toString in class AbstractCollectionpublic int size()
size in interface Collectionsize in interface Listsize in class AbstractCollectionpublic Object get(int index)
IndexOutOfBoundsException for an empty range.get in interface Listget in class AbstractListIndexOutOfBoundsException - alwayspublic boolean add(Object o)
UnsupportedOperationException for an empty range.add in interface Collectionadd in interface Listadd in class AbstractListUnsupportedOperationException - alwayspublic boolean addAll(int index,
Collection c)
UnsupportedOperationException for an empty range.addAll in interface ListaddAll in class AbstractListUnsupportedOperationExceptionpublic boolean addAll(Collection c)
UnsupportedOperationException for an empty range.addAll in interface CollectionaddAll in interface ListaddAll in class AbstractCollectionUnsupportedOperationExceptionpublic boolean remove(Object o)
UnsupportedOperationException for an empty range.remove in interface Collectionremove in interface Listremove in class AbstractCollectionUnsupportedOperationExceptionpublic Object remove(int index)
UnsupportedOperationException for an empty range.remove in interface Listremove in class AbstractListUnsupportedOperationExceptionpublic boolean removeAll(Collection c)
UnsupportedOperationException for an empty range.removeAll in interface CollectionremoveAll in interface ListremoveAll in class AbstractCollectionUnsupportedOperationExceptionpublic boolean retainAll(Collection c)
UnsupportedOperationException for an empty range.retainAll in interface CollectionretainAll in interface ListretainAll in class AbstractCollectionUnsupportedOperationExceptionpublic Object set(int index, Object element)
UnsupportedOperationException for an empty range.set in interface Listset in class AbstractListUnsupportedOperationExceptionpublic void step(int step,
Closure closure)