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>
Constructing Ranges like 0..<0
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected TThe value at which the range originates (may benull).Fields inherited from class java.util.AbstractListmodCount
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanAlways 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.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.booleanremoveAll(Collection<?> c) Always throwsUnsupportedOperationExceptionfor an empty range.booleanretainAll(Collection<?> c) Always 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.AbstractListadd, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class java.util.AbstractCollectioncontains, containsAll, isEmpty, toArray, toArrayMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.CollectionparallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Listadd, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, replaceAll, sort, spliterator, subList, toArray, toArray
- 
Field Details- 
atThe value at which the range originates (may benull).
 
- 
- 
Constructor Details- 
EmptyRangeCreates a newEmptyRange.- Parameters:
- at- the value at which the range starts (may be- null).
 
 
- 
- 
Method Details- 
getFromThe lower value in the range.- Specified by:
- getFromin interface- Range<T extends Comparable>
- Returns:
- the lower value in the range.
 
- 
getToThe 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
 
- 
containsWithinBoundsNever 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
 
- 
inspect
- 
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
 
- 
getAlways throwsIndexOutOfBoundsExceptionfor an empty range.- Specified by:
- getin interface- List<T extends Comparable>
- Specified by:
- getin class- AbstractList<T extends Comparable>
- Throws:
- IndexOutOfBoundsException- always
 
- 
addAlways 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
 
- 
addAllAlways throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- addAllin interface- List<T extends Comparable>
- Overrides:
- addAllin class- AbstractList<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
- 
addAllAlways 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
 
- 
removeAlways 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
 
- 
removeAlways throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- removein interface- List<T extends Comparable>
- Overrides:
- removein class- AbstractList<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
- 
removeAllAlways 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
 
- 
retainAllAlways 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
 
- 
setAlways throwsUnsupportedOperationExceptionfor an empty range.- Specified by:
- setin interface- List<T extends Comparable>
- Overrides:
- setin class- AbstractList<T extends Comparable>
- Throws:
- UnsupportedOperationException
 
- 
stepAlways 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
 
- 
stepAlways 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.
 
 
-