Package groovy.lang
Class EmptyRange<T extends java.lang.Comparable>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<T>
-
- groovy.lang.EmptyRange<T>
-
-
Constructor Summary
Constructors Constructor Description EmptyRange(T at)
Creates a newEmptyRange
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T o)
Always throwsUnsupportedOperationException
for an empty range.boolean
addAll(int index, java.util.Collection<? extends T> c)
Always throwsUnsupportedOperationException
for an empty range.boolean
addAll(java.util.Collection<? extends T> c)
Always throwsUnsupportedOperationException
for an empty range.boolean
containsWithinBounds(java.lang.Object o)
Never true for an empty range.T
get(int index)
Always throwsIndexOutOfBoundsException
for an empty range.T
getFrom()
The lower value in the range.T
getTo()
The upper value in the range.java.lang.String
inspect()
boolean
isReverse()
Never true for an empty range.T
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.T
set(int index, T element)
Always throwsUnsupportedOperationException
for an empty range.int
size()
Always 0 for an empty range.java.util.List<T>
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
-
-
-
-
Field Detail
-
at
protected T extends java.lang.Comparable at
The value at which the range originates (may benull
).
-
-
Constructor Detail
-
EmptyRange
public EmptyRange(T at)
Creates a newEmptyRange
.- Parameters:
at
- the value at which the range starts (may benull
).
-
-
Method Detail
-
getFrom
public T getFrom()
The lower value in the range.
-
getTo
public T 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<T extends java.lang.Comparable>
- 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<T extends java.lang.Comparable>
-
size
public int size()
Always 0 for an empty range.
-
get
public T get(int index)
Always throwsIndexOutOfBoundsException
for an empty range.
-
add
public boolean add(T o)
Always throwsUnsupportedOperationException
for an empty range.
-
addAll
public boolean addAll(int index, java.util.Collection<? extends T> c)
Always throwsUnsupportedOperationException
for an empty range.
-
addAll
public boolean addAll(java.util.Collection<? extends T> c)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
addAll
in interfacejava.util.Collection<T extends java.lang.Comparable>
- Specified by:
addAll
in interfacejava.util.List<T extends java.lang.Comparable>
- Overrides:
addAll
in classjava.util.AbstractCollection<T extends java.lang.Comparable>
- 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<T extends java.lang.Comparable>
- Specified by:
remove
in interfacejava.util.List<T extends java.lang.Comparable>
- Overrides:
remove
in classjava.util.AbstractCollection<T extends java.lang.Comparable>
- Throws:
java.lang.UnsupportedOperationException
-
remove
public T remove(int index)
Always throwsUnsupportedOperationException
for an empty range.
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
Always throwsUnsupportedOperationException
for an empty range.- Specified by:
removeAll
in interfacejava.util.Collection<T extends java.lang.Comparable>
- Specified by:
removeAll
in interfacejava.util.List<T extends java.lang.Comparable>
- Overrides:
removeAll
in classjava.util.AbstractCollection<T extends java.lang.Comparable>
- 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<T extends java.lang.Comparable>
- Specified by:
retainAll
in interfacejava.util.List<T extends java.lang.Comparable>
- Overrides:
retainAll
in classjava.util.AbstractCollection<T extends java.lang.Comparable>
- Throws:
java.lang.UnsupportedOperationException
-
set
public T set(int index, T element)
Always throwsUnsupportedOperationException
for an empty range.
-
step
public void step(int step, Closure closure)
Always does nothing for an empty range.
-
step
public java.util.List<T> step(int step)
Always returns an empty list for an empty range.
-
-