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.Comparable
at
The 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 boolean
add(java.lang.Object o)
Always throwsUnsupportedOperationException
for an empty range.boolean
addAll(int index, java.util.Collection c)
Always throwsUnsupportedOperationException
for an empty range.boolean
addAll(java.util.Collection c)
Always throwsUnsupportedOperationException
for an empty range.boolean
containsWithinBounds(java.lang.Object o)
Never true for an empty range.java.lang.Object
get(int index)
Always throwsIndexOutOfBoundsException
for an empty range.java.lang.Comparable
getFrom()
The lower value in the range.java.lang.Comparable
getTo()
The upper value in the range.java.lang.String
inspect()
boolean
isReverse()
Never true for an empty range.java.lang.Object
remove(int index)
Always throwsUnsupportedOperationException
for an empty range.boolean
remove(java.lang.Object o)
Always throwsUnsupportedOperationException
for an empty range.boolean
removeAll(java.util.Collection c)
Always throwsUnsupportedOperationException
for an empty range.boolean
retainAll(java.util.Collection c)
Always throwsUnsupportedOperationException
for an empty range.java.lang.Object
set(int index, java.lang.Object element)
Always throwsUnsupportedOperationException
for an empty range.int
size()
Always 0 for an empty range.java.util.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.java.lang.String
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
-
-
-
-
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:
containsWithinBounds
in 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:
toString
in classjava.util.AbstractCollection
-
size
public int size()
Always 0 for an empty range.- Specified by:
size
in interfacejava.util.Collection
- Specified by:
size
in interfacejava.util.List
- Specified by:
size
in classjava.util.AbstractCollection
- Returns:
- 0
-
get
public java.lang.Object get(int index)
Always throwsIndexOutOfBoundsException
for an empty range.- Specified by:
get
in interfacejava.util.List
- Specified by:
get
in classjava.util.AbstractList
- Throws:
java.lang.IndexOutOfBoundsException
- always
-
add
public boolean add(java.lang.Object o)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
add
in interfacejava.util.Collection
- Specified by:
add
in interfacejava.util.List
- Overrides:
add
in classjava.util.AbstractList
- Throws:
java.lang.UnsupportedOperationException
- always
-
addAll
public boolean addAll(int index, java.util.Collection c)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
addAll
in interfacejava.util.List
- Overrides:
addAll
in classjava.util.AbstractList
- Throws:
java.lang.UnsupportedOperationException
-
addAll
public boolean addAll(java.util.Collection c)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
addAll
in interfacejava.util.Collection
- Specified by:
addAll
in interfacejava.util.List
- Overrides:
addAll
in classjava.util.AbstractCollection
- Throws:
java.lang.UnsupportedOperationException
-
remove
public boolean remove(java.lang.Object o)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
remove
in interfacejava.util.Collection
- Specified by:
remove
in interfacejava.util.List
- Overrides:
remove
in classjava.util.AbstractCollection
- Throws:
java.lang.UnsupportedOperationException
-
remove
public java.lang.Object remove(int index)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
remove
in interfacejava.util.List
- Overrides:
remove
in classjava.util.AbstractList
- Throws:
java.lang.UnsupportedOperationException
-
removeAll
public boolean removeAll(java.util.Collection c)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
removeAll
in interfacejava.util.Collection
- Specified by:
removeAll
in interfacejava.util.List
- Overrides:
removeAll
in classjava.util.AbstractCollection
- Throws:
java.lang.UnsupportedOperationException
-
retainAll
public boolean retainAll(java.util.Collection c)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
retainAll
in interfacejava.util.Collection
- Specified by:
retainAll
in interfacejava.util.List
- Overrides:
retainAll
in classjava.util.AbstractCollection
- Throws:
java.lang.UnsupportedOperationException
-
set
public java.lang.Object set(int index, java.lang.Object element)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
set
in interfacejava.util.List
- Overrides:
set
in 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.
-
-