Package groovy.lang
Class EmptyRange<T extends Comparable>
- java.lang.Object
- 
- java.util.AbstractCollection<E>
- 
- java.util.AbstractList<T>
- 
- groovy.lang.EmptyRange<T>
 
 
 
- 
- All Implemented Interfaces:
- Range<T>,- Iterable<T>,- Collection<T>,- List<T>
 
 public class EmptyRange<T extends Comparable> extends AbstractList<T> implements Range<T> Constructing Ranges like 0..<0
- 
- 
Field SummaryFields Modifier and Type Field Description protected TatThe value at which the range originates (may benull).- 
Fields inherited from class java.util.AbstractListmodCount
 
- 
 - 
Constructor SummaryConstructors Constructor Description EmptyRange(T at)Creates a newEmptyRange.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T o)Always throwsUnsupportedOperationExceptionfor an empty range.booleanaddAll(int index, Collection<? extends T> c)Always throwsUnsupportedOperationExceptionfor an empty range.booleanaddAll(Collection<? extends T> c)Always throwsUnsupportedOperationExceptionfor an empty range.booleancontainsWithinBounds(Object o)Never true for an empty range.Tget(int index)Always throwsIndexOutOfBoundsExceptionfor an empty range.TgetFrom()The lower value in the range.TgetTo()The upper value in the range.Stringinspect()booleanisReverse()Never true for an empty range.Tremove(int index)Always throwsUnsupportedOperationExceptionfor an empty range.booleanremove(Object o)Always throwsUnsupportedOperationExceptionfor an empty range.booleanremoveAll(Collection<?> c)Always throwsUnsupportedOperationExceptionfor an empty range.booleanretainAll(Collection<?> c)Always throwsUnsupportedOperationExceptionfor an empty range.Tset(int index, T element)Always throwsUnsupportedOperationExceptionfor an empty range.intsize()Always 0 for an empty range.List<T>step(int step)Always returns an empty list for an empty range.voidstep(int step, Closure closure)Always does nothing for an empty range.StringtoString()- 
Methods inherited from class java.util.AbstractListadd, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 - 
Methods inherited from class java.util.AbstractCollectioncontains, containsAll, isEmpty, toArray, toArray
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface java.util.CollectionparallelStream, removeIf, stream, toArray
 - 
Methods inherited from interface java.util.Listadd, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, replaceAll, sort, spliterator, subList, toArray, toArray
 
- 
 
- 
- 
- 
Field Detail- 
atprotected T extends Comparable at The value at which the range originates (may benull).
 
- 
 - 
Constructor Detail- 
EmptyRangepublic EmptyRange(T at) Creates a newEmptyRange.- Parameters:
- at- the value at which the range starts (may be- null).
 
 
- 
 - 
Method Detail- 
getFrompublic T getFrom() The lower value in the range.- Specified by:
- getFromin interface- Range<T extends Comparable>
- Returns:
- the lower value in the range.
 
 - 
getTopublic T getTo() The upper value in the range.- Specified by:
- getToin interface- Range<T extends Comparable>
- Returns:
- the upper value in the range
 
 - 
isReversepublic boolean isReverse() Never true for an empty range.- Specified by:
- isReversein interface- Range<T extends Comparable>
- Returns:
- false
 
 - 
containsWithinBoundspublic boolean containsWithinBounds(Object o) Never true for an empty range.- Specified by:
- containsWithinBoundsin interface- Range<T extends Comparable>
- Parameters:
- o- the object to check against the boundaries of the range
- Returns:
- false
 
 - 
inspectpublic String inspect() 
 - 
toStringpublic String toString() - Overrides:
- toStringin class- AbstractCollection<T extends Comparable>
 
 - 
sizepublic int size() Always 0 for an empty range.- Specified by:
- sizein interface- Collection<T extends Comparable>
- Specified by:
- sizein interface- List<T extends Comparable>
- Specified by:
- sizein class- AbstractCollection<T extends Comparable>
- Returns:
- 0
 
 - 
getpublic T get(int index) Always throwsIndexOutOfBoundsExceptionfor an empty range.- Specified by:
- getin interface- List<T extends Comparable>
- Specified by:
- getin class- AbstractList<T extends Comparable>
- Throws:
- IndexOutOfBoundsException- always
 
 - 
addpublic boolean add(T o) Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- addin interface- Collection<T extends Comparable>
- Specified by:
- addin interface- List<T extends Comparable>
- Overrides:
- addin class- AbstractList<T extends Comparable>
- Throws:
- UnsupportedOperationException- always
 
 - 
addAllpublic boolean addAll(int index, Collection<? extends T> c)Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- addAllin interface- List<T extends Comparable>
- Overrides:
- addAllin class- AbstractList<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
 - 
addAllpublic boolean addAll(Collection<? extends T> c) Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- addAllin interface- Collection<T extends Comparable>
- Specified by:
- addAllin interface- List<T extends Comparable>
- Overrides:
- addAllin class- AbstractCollection<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
 - 
removepublic boolean remove(Object o) Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- removein interface- Collection<T extends Comparable>
- Specified by:
- removein interface- List<T extends Comparable>
- Overrides:
- removein class- AbstractCollection<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
 - 
removepublic T remove(int index) Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- removein interface- List<T extends Comparable>
- Overrides:
- removein class- AbstractList<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
 - 
removeAllpublic boolean removeAll(Collection<?> c) Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- removeAllin interface- Collection<T extends Comparable>
- Specified by:
- removeAllin interface- List<T extends Comparable>
- Overrides:
- removeAllin class- AbstractCollection<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
 - 
retainAllpublic boolean retainAll(Collection<?> c) Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- retainAllin interface- Collection<T extends Comparable>
- Specified by:
- retainAllin interface- List<T extends Comparable>
- Overrides:
- retainAllin class- AbstractCollection<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
 - 
setpublic T set(int index, T element) Always throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- setin interface- List<T extends Comparable>
- Overrides:
- setin class- AbstractList<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
 - 
steppublic void step(int step, Closure closure)Always does nothing for an empty range.- Specified by:
- stepin interface- Range<T extends Comparable>
- Parameters:
- step- the amount by which to step. If negative, steps through the range backwards.
- closure- the- Closureto call
 
 - 
steppublic List<T> step(int step) Always returns an empty list for an empty range.- Specified by:
- stepin interface- Range<T extends Comparable>
- Parameters:
- step- the amount by which to step. If negative, steps through the range backwards.
- Returns:
- the list formed by stepping through the range by the indicated interval.
 
 
- 
 
-