Package groovy.lang
Class EmptyRange
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
groovy.lang.EmptyRange
- All Implemented Interfaces:
Range,Iterable,Collection,List,SequencedCollection
Constructing Ranges like 0..invalid input: '<'0
- Author:
- Dierk Koenig, Edwin Tellman
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ComparableThe value at which the range originates (may benull).Fields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAlways throwsUnsupportedOperationExceptionfor an empty range.booleanaddAll(int index, Collection c) Always throwsUnsupportedOperationExceptionfor an empty range.booleanaddAll(Collection c) Always throwsUnsupportedOperationExceptionfor an empty range.booleanNever true for an empty range.get(int index) Always throwsIndexOutOfBoundsExceptionfor an empty range.getFrom()The lower value in the range.getTo()The upper value in the range.inspect()booleanNever true for an empty range.remove(int index) Always throwsUnsupportedOperationExceptionfor an empty range.booleanAlways throwsUnsupportedOperationExceptionfor an empty range.booleanAlways throwsUnsupportedOperationExceptionfor an empty range.booleanAlways throwsUnsupportedOperationExceptionfor an empty range.Always throwsUnsupportedOperationExceptionfor an empty range.intsize()Always 0 for an empty range.step(int step) Always returns an empty list for an empty range.voidAlways does nothing for an empty range.toString()Methods inherited from class java.util.AbstractList
add, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.List
add, addFirst, addLast, clear, contains, containsAll, equals, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeFirst, removeLast, replaceAll, reversed, sort, spliterator, subList, toArray, toArray
-
Field Details
-
at
The value at which the range originates (may benull).
-
-
Constructor Details
-
EmptyRange
Creates a newEmptyRange.- Parameters:
at- the value at which the range starts (may benull).
-
-
Method Details
-
getFrom
The lower value in the range. -
getTo
The upper value in the range. -
isReverse
public boolean isReverse()Never true for an empty range. -
containsWithinBounds
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
-
toString
- Overrides:
toStringin classAbstractCollection
-
size
public int size()Always 0 for an empty range.- Specified by:
sizein interfaceCollection- Specified by:
sizein interfaceList- Specified by:
sizein classAbstractCollection- Returns:
- 0
-
get
Always throwsIndexOutOfBoundsExceptionfor an empty range.- Specified by:
getin interfaceList- Specified by:
getin classAbstractList- Throws:
IndexOutOfBoundsException- always
-
add
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
addin interfaceCollection- Specified by:
addin interfaceList- Overrides:
addin classAbstractList- Throws:
UnsupportedOperationException- always
-
addAll
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
addAllin interfaceList- Overrides:
addAllin classAbstractList- Throws:
UnsupportedOperationException
-
addAll
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
addAllin interfaceCollection- Specified by:
addAllin interfaceList- Overrides:
addAllin classAbstractCollection- Throws:
UnsupportedOperationException
-
remove
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
removein interfaceCollection- Specified by:
removein interfaceList- Overrides:
removein classAbstractCollection- Throws:
UnsupportedOperationException
-
remove
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
removein interfaceList- Overrides:
removein classAbstractList- Throws:
UnsupportedOperationException
-
removeAll
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
removeAllin interfaceCollection- Specified by:
removeAllin interfaceList- Overrides:
removeAllin classAbstractCollection- Throws:
UnsupportedOperationException
-
retainAll
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
retainAllin interfaceCollection- Specified by:
retainAllin interfaceList- Overrides:
retainAllin classAbstractCollection- Throws:
UnsupportedOperationException
-
set
Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
setin interfaceList- Overrides:
setin classAbstractList- Throws:
UnsupportedOperationException
-
step
Always does nothing for an empty range. -
step
Always returns an empty list for an empty range.
-