Package groovy.lang
Class EmptyRange
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList
groovy.lang.EmptyRange
- All Implemented Interfaces:
Range
,Iterable
,Collection
,List
Constructing Ranges like 0..<0
-
Field Summary
Modifier and TypeFieldDescriptionprotected Comparable
The value at which the range originates (may benull
).Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Always throwsUnsupportedOperationException
for an empty range.boolean
addAll
(int index, Collection c) Always throwsUnsupportedOperationException
for an empty range.boolean
addAll
(Collection c) Always throwsUnsupportedOperationException
for an empty range.boolean
Never true for an empty range.get
(int index) Always throwsIndexOutOfBoundsException
for an empty range.getFrom()
The lower value in the range.getTo()
The upper value in the range.inspect()
boolean
Never true for an empty range.remove
(int index) Always throwsUnsupportedOperationException
for an empty range.boolean
Always throwsUnsupportedOperationException
for an empty range.boolean
Always throwsUnsupportedOperationException
for an empty range.boolean
Always throwsUnsupportedOperationException
for an empty range.Always throwsUnsupportedOperationException
for an empty range.int
size()
Always 0 for an empty range.step
(int step) Always returns an empty list for an empty range.void
Always does nothing for an empty range.toString()
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
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
add, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, replaceAll, 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:
containsWithinBounds
in interfaceRange
- Parameters:
o
- the object to check against the boundaries of the range- Returns:
false
-
inspect
-
toString
- Overrides:
toString
in classAbstractCollection
-
size
public int size()Always 0 for an empty range.- Specified by:
size
in interfaceCollection
- Specified by:
size
in interfaceList
- Specified by:
size
in classAbstractCollection
- Returns:
- 0
-
get
Always throwsIndexOutOfBoundsException
for an empty range.- Specified by:
get
in interfaceList
- Specified by:
get
in classAbstractList
- Throws:
IndexOutOfBoundsException
- always
-
add
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
add
in interfaceCollection
- Specified by:
add
in interfaceList
- Overrides:
add
in classAbstractList
- Throws:
UnsupportedOperationException
- always
-
addAll
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
addAll
in interfaceList
- Overrides:
addAll
in classAbstractList
- Throws:
UnsupportedOperationException
-
addAll
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
addAll
in interfaceCollection
- Specified by:
addAll
in interfaceList
- Overrides:
addAll
in classAbstractCollection
- Throws:
UnsupportedOperationException
-
remove
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
remove
in interfaceCollection
- Specified by:
remove
in interfaceList
- Overrides:
remove
in classAbstractCollection
- Throws:
UnsupportedOperationException
-
remove
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
remove
in interfaceList
- Overrides:
remove
in classAbstractList
- Throws:
UnsupportedOperationException
-
removeAll
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
removeAll
in interfaceCollection
- Specified by:
removeAll
in interfaceList
- Overrides:
removeAll
in classAbstractCollection
- Throws:
UnsupportedOperationException
-
retainAll
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
retainAll
in interfaceCollection
- Specified by:
retainAll
in interfaceList
- Overrides:
retainAll
in classAbstractCollection
- Throws:
UnsupportedOperationException
-
set
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
set
in interfaceList
- Overrides:
set
in classAbstractList
- Throws:
UnsupportedOperationException
-
step
Always does nothing for an empty range. -
step
Always returns an empty list for an empty range.
-