Package groovy.lang
Class EmptyRange
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList
-
- groovy.lang.EmptyRange
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ComparableatThe value at which the range originates (may benull).
-
Constructor Summary
Constructors Constructor Description EmptyRange(java.lang.Comparable at)Creates a newEmptyRange.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(java.lang.Object o)Always throwsUnsupportedOperationExceptionfor an empty range.booleanaddAll(int index, java.util.Collection c)Always throwsUnsupportedOperationExceptionfor an empty range.booleanaddAll(java.util.Collection c)Always throwsUnsupportedOperationExceptionfor an empty range.booleancontainsWithinBounds(java.lang.Object o)Never true for an empty range.java.lang.Objectget(int index)Always throwsIndexOutOfBoundsExceptionfor an empty range.java.lang.ComparablegetFrom()The lower value in the range.java.lang.ComparablegetTo()The upper value in the range.java.lang.Stringinspect()booleanisReverse()Never true for an empty range.java.lang.Objectremove(int index)Always throwsUnsupportedOperationExceptionfor an empty range.booleanremove(java.lang.Object o)Always throwsUnsupportedOperationExceptionfor an empty range.booleanremoveAll(java.util.Collection c)Always throwsUnsupportedOperationExceptionfor an empty range.booleanretainAll(java.util.Collection c)Always throwsUnsupportedOperationExceptionfor an empty range.java.lang.Objectset(int index, java.lang.Object element)Always throwsUnsupportedOperationExceptionfor an empty range.intsize()Always 0 for an empty range.java.util.Liststep(int step)Always returns an empty list for an empty range.voidstep(int step, Closure closure)Always does nothing for an empty range.java.lang.StringtoString()-
Methods inherited from class java.util.AbstractList
add, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, toArray, toArray
-
-
-
-
Constructor Detail
-
EmptyRange
public EmptyRange(java.lang.Comparable at)
Creates a newEmptyRange.- Parameters:
at- the value at which the range starts (may benull).
-
-
Method Detail
-
getFrom
public java.lang.Comparable getFrom()
The lower value in the range.
-
getTo
public java.lang.Comparable getTo()
The upper value in the range.
-
isReverse
public boolean isReverse()
Never true for an empty range.
-
containsWithinBounds
public boolean containsWithinBounds(java.lang.Object o)
Never true for an empty range.- Specified by:
containsWithinBoundsin interfaceRange- Parameters:
o- the object to check against the boundaries of the range- Returns:
false
-
inspect
public java.lang.String inspect()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.util.AbstractCollection
-
size
public int size()
Always 0 for an empty range.- Specified by:
sizein interfacejava.util.Collection- Specified by:
sizein interfacejava.util.List- Specified by:
sizein classjava.util.AbstractCollection- Returns:
- 0
-
get
public java.lang.Object get(int index)
Always throwsIndexOutOfBoundsExceptionfor an empty range.- Specified by:
getin interfacejava.util.List- Specified by:
getin classjava.util.AbstractList- Throws:
java.lang.IndexOutOfBoundsException- always
-
add
public boolean add(java.lang.Object o)
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
addin interfacejava.util.Collection- Specified by:
addin interfacejava.util.List- Overrides:
addin classjava.util.AbstractList- Throws:
java.lang.UnsupportedOperationException- always
-
addAll
public boolean addAll(int index, java.util.Collection c)Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
addAllin interfacejava.util.List- Overrides:
addAllin classjava.util.AbstractList- Throws:
java.lang.UnsupportedOperationException
-
addAll
public boolean addAll(java.util.Collection c)
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
addAllin interfacejava.util.Collection- Specified by:
addAllin interfacejava.util.List- Overrides:
addAllin classjava.util.AbstractCollection- Throws:
java.lang.UnsupportedOperationException
-
remove
public boolean remove(java.lang.Object o)
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
removein interfacejava.util.Collection- Specified by:
removein interfacejava.util.List- Overrides:
removein classjava.util.AbstractCollection- Throws:
java.lang.UnsupportedOperationException
-
remove
public java.lang.Object remove(int index)
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
removein interfacejava.util.List- Overrides:
removein classjava.util.AbstractList- Throws:
java.lang.UnsupportedOperationException
-
removeAll
public boolean removeAll(java.util.Collection c)
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
removeAllin interfacejava.util.Collection- Specified by:
removeAllin interfacejava.util.List- Overrides:
removeAllin classjava.util.AbstractCollection- Throws:
java.lang.UnsupportedOperationException
-
retainAll
public boolean retainAll(java.util.Collection c)
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
retainAllin interfacejava.util.Collection- Specified by:
retainAllin interfacejava.util.List- Overrides:
retainAllin classjava.util.AbstractCollection- Throws:
java.lang.UnsupportedOperationException
-
set
public java.lang.Object set(int index, java.lang.Object element)Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
setin interfacejava.util.List- Overrides:
setin classjava.util.AbstractList- Throws:
java.lang.UnsupportedOperationException
-
step
public void step(int step, Closure closure)Always does nothing for an empty range.
-
step
public java.util.List step(int step)
Always returns an empty list for an empty range.
-
-