Top Description Fields Constructors Methods
groovy.lang

public Class EmptyRange<T extends java.lang.Comparable<T>>

extends AbstractList<T extends Comparable<T>>
implements Range<T extends Comparable<T>>
Class Inheritance
All Implemented Interfaces
groovy.lang.Range, java.util.List, java.util.SequencedCollection, java.util.Collection, java.lang.Iterable
Imports
org.codehaus.groovy.runtime.InvokerHelper, java.util.AbstractList, .ArrayList, .Collection, .List

Constructing Ranges like 0..<0

Field Summary

Modifier and TypeField and Description
protected T
at

The value at which the range originates (may be null).

Inherited from java.util.AbstractList:
modCount

Constructor Summary

AccessConstructor and Description
public
EmptyRange(T
the value at which the range starts (may be null).
at
)

Creates a new EmptyRange.

Method Summary

Modifier and TypeMethod and Description
public boolean
add(T
element to be appended to this list
o
)

Overrides java.util.AbstractList.add.

Implements java.util.List.add, java.util.Collection.add.

Always throws UnsupportedOperationException for an empty range.
public boolean
addAll(int
index at which to insert the first element from the specified collection
index
,
Collection<? extends T>
collection containing elements to be added to this list
c
)

Overrides java.util.AbstractList.addAll.

Implements java.util.List.addAll.

Always throws UnsupportedOperationException for an empty range.
public boolean
addAll(Collection<? extends T>
collection containing elements to be added to this list
c
)

Overrides java.util.AbstractCollection.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Always throws UnsupportedOperationException for an empty range.
public boolean

Returns:

false
containsWithinBounds
(Object
the object to check against the boundaries of the range
o
)

Implements groovy.lang.Range.containsWithinBounds.

Never true for an empty range.
public T
get(int
index of the element to return
index
)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Always throws IndexOutOfBoundsException for an empty range.
public T
getFrom()

Implements groovy.lang.Range.getFrom.

The lower value in the range.
public T
getTo()

Implements groovy.lang.Range.getTo.

The upper value in the range.
public String
public boolean

Returns:

false
isReverse
()

Implements groovy.lang.Range.isReverse.

Never true for an empty range.
public boolean
remove(Object
element to be removed from this list, if present
o
)

Overrides java.util.AbstractCollection.remove.

Implements java.util.List.remove, java.util.Collection.remove.

Always throws UnsupportedOperationException for an empty range.
public T
remove(int
the index of the element to be removed
index
)

Overrides java.util.AbstractList.remove.

Implements java.util.List.remove.

Always throws UnsupportedOperationException for an empty range.
public boolean
removeAll(Collection<?>
collection containing elements to be removed from this list
c
)

Overrides java.util.AbstractCollection.removeAll.

Implements java.util.List.removeAll, java.util.Collection.removeAll.

Always throws UnsupportedOperationException for an empty range.
public boolean
retainAll(Collection<?>
collection containing elements to be retained in this list
c
)

Overrides java.util.AbstractCollection.retainAll.

Implements java.util.List.retainAll, java.util.Collection.retainAll.

Always throws UnsupportedOperationException for an empty range.
public T
set(int
index of the element to replace
index
,
T
element to be stored at the specified position
element
)

Overrides java.util.AbstractList.set.

Implements java.util.List.set.

Always throws UnsupportedOperationException for an empty range.
public int

Returns:

0
size
()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Always 0 for an empty range.
public void
step(int
the amount by which to step. If negative, steps through the range backwards.
step
,
Closure<V>
the Closure to call
closure
)

Implements groovy.lang.Range.step.

Always does nothing for an empty range.
public List<T>
step(int
the amount by which to step. If negative, steps through the range backwards.
step
)

Implements groovy.lang.Range.step.

Always returns an empty list for an empty range.
public String
toString()

Overrides java.util.AbstractCollection.toString.

Returns a string representation of this collection.
Inherited from java.util.AbstractList:
addclearequalshashCodeindexOfiteratorlastIndexOflistIteratorlistIteratorremoveRangesubList

Field Detail

atback to summary
protected T at

The value at which the range originates (may be null).

Constructor Detail

EmptyRangeback to summary
public EmptyRange(T at)

Creates a new EmptyRange.

Parameters
at:T

the value at which the range starts (may be null).

Method Detail

addback to summary
public boolean add(T o)

Overrides java.util.AbstractList.add.

Implements java.util.List.add, java.util.Collection.add.

Always throws UnsupportedOperationException for an empty range.

Parameters
o:T

Doc from java.util.List.add.

element to be appended to this list

Returns:boolean

Doc from java.util.List.add.

true (as specified by Collection#add)

Annotations
@Override
Exceptions
UnsupportedOperationException:
always
addAllback to summary
public boolean addAll(int index, Collection<? extends T> c)

Overrides java.util.AbstractList.addAll.

Implements java.util.List.addAll.

Always throws UnsupportedOperationException for an empty range.

Parameters
index:int

Doc from java.util.List.addAll.

index at which to insert the first element from the specified collection

c:Collection<? extends T>

Doc from java.util.List.addAll.

collection containing elements to be added to this list

Returns:boolean

Doc from java.util.List.addAll.

true if this list changed as a result of the call

Annotations
@Override
Exceptions
UnsupportedOperationException:

Doc from java.util.List.addAll.

if the addAll operation is not supported by this list

addAllback to summary
public boolean addAll(Collection<? extends T> c)

Overrides java.util.AbstractCollection.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Always throws UnsupportedOperationException for an empty range.

Parameters
c:Collection<? extends T>

Doc from java.util.List.addAll.

collection containing elements to be added to this list

Returns:boolean

Doc from java.util.List.addAll.

true if this list changed as a result of the call

Annotations
@Override
Exceptions
UnsupportedOperationException:

Doc from java.util.List.addAll.

if the addAll operation is not supported by this list

containsWithinBoundsback to summary
public boolean containsWithinBounds(Object o)

Implements groovy.lang.Range.containsWithinBounds.

Never true for an empty range.

Parameters
o:Object

Doc from groovy.lang.Range.containsWithinBounds.

the object to check against the boundaries of the range

Returns:boolean

false

Annotations
@Override
getback to summary
public T get(int index)

Implements abstract java.util.AbstractList.get.

Implements java.util.List.get.

Always throws IndexOutOfBoundsException for an empty range.

Parameters
index:int

Doc from java.util.List.get.

index of the element to return

Returns:T

Doc from java.util.List.get.

the element at the specified position in this list

Annotations
@Override
Exceptions
IndexOutOfBoundsException:
always
getFromback to summary
public T getFrom()

Implements groovy.lang.Range.getFrom.

Doc from groovy.lang.Range.getFrom.

The lower value in the range.

Returns:T

the lower value in the range.

Annotations
@Override
getToback to summary
public T getTo()

Implements groovy.lang.Range.getTo.

Doc from groovy.lang.Range.getTo.

The upper value in the range.

Returns:T

the upper value in the range

Annotations
@Override
inspectback to summary
public String inspect()

Implements groovy.lang.Range.inspect.

Returns:String

Doc from groovy.lang.Range.inspect.

the verbose String representation of this Range as would be typed into a console to create the Range instance

Annotations
@Override
isReverseback to summary
public boolean isReverse()

Implements groovy.lang.Range.isReverse.

Never true for an empty range.

Returns:boolean

false

Annotations
@Override
removeback to summary
public boolean remove(Object o)

Overrides java.util.AbstractCollection.remove.

Implements java.util.List.remove, java.util.Collection.remove.

Always throws UnsupportedOperationException for an empty range.

Parameters
o:Object

Doc from java.util.List.remove.

element to be removed from this list, if present

Returns:boolean

Doc from java.util.List.remove.

true if this list contained the specified element

Annotations
@Override
Exceptions
UnsupportedOperationException:

Doc from java.util.List.remove.

if the remove operation is not supported by this list

removeback to summary
public T remove(int index)

Overrides java.util.AbstractList.remove.

Implements java.util.List.remove.

Always throws UnsupportedOperationException for an empty range.

Parameters
index:int

Doc from java.util.List.remove.

the index of the element to be removed

Returns:T

Doc from java.util.List.remove.

the element previously at the specified position

Annotations
@Override
Exceptions
UnsupportedOperationException:

Doc from java.util.List.remove.

if the remove operation is not supported by this list

removeAllback to summary
public boolean removeAll(Collection<?> c)

Overrides java.util.AbstractCollection.removeAll.

Implements java.util.List.removeAll, java.util.Collection.removeAll.

Always throws UnsupportedOperationException for an empty range.

Parameters
c:Collection<?>

Doc from java.util.List.removeAll.

collection containing elements to be removed from this list

Returns:boolean

Doc from java.util.List.removeAll.

true if this list changed as a result of the call

Annotations
@Override
Exceptions
UnsupportedOperationException:

Doc from java.util.List.removeAll.

if the removeAll operation is not supported by this list

retainAllback to summary
public boolean retainAll(Collection<?> c)

Overrides java.util.AbstractCollection.retainAll.

Implements java.util.List.retainAll, java.util.Collection.retainAll.

Always throws UnsupportedOperationException for an empty range.

Parameters
c:Collection<?>

Doc from java.util.List.retainAll.

collection containing elements to be retained in this list

Returns:boolean

Doc from java.util.List.retainAll.

true if this list changed as a result of the call

Annotations
@Override
Exceptions
UnsupportedOperationException:

Doc from java.util.List.retainAll.

if the retainAll operation is not supported by this list

setback to summary
public T set(int index, T element)

Overrides java.util.AbstractList.set.

Implements java.util.List.set.

Always throws UnsupportedOperationException for an empty range.

Parameters
index:int

Doc from java.util.List.set.

index of the element to replace

element:T

Doc from java.util.List.set.

element to be stored at the specified position

Returns:T

Doc from java.util.List.set.

the element previously at the specified position

Annotations
@Override
Exceptions
UnsupportedOperationException:

Doc from java.util.List.set.

if the set operation is not supported by this list

sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.List.size, java.util.Collection.size.

Always 0 for an empty range.

Returns:int

0

Annotations
@Override
stepback to summary
public void step(int step, Closure<V> closure)

Implements groovy.lang.Range.step.

Always does nothing for an empty range.

Parameters
step:int

Doc from groovy.lang.Range.step.

the amount by which to step. If negative, steps through the range backwards.

closure:Closure<V>

Doc from groovy.lang.Range.step.

the Closure to call

Annotations
@Override
stepback to summary
public List<T> step(int step)

Implements groovy.lang.Range.step.

Always returns an empty list for an empty range.

Parameters
step:int

Doc from groovy.lang.Range.step.

the amount by which to step. If negative, steps through the range backwards.

Returns:List<T>

Doc from groovy.lang.Range.step.

the list formed by stepping through the range by the indicated interval.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.util.AbstractCollection.toString.

Doc from java.util.AbstractCollection.toString.

Returns a string representation of this collection. The string representation consists of a list of the collection's elements in the order they are returned by its iterator, enclosed in square brackets ("[]"). Adjacent elements are separated by the characters ", " (comma and space). Elements are converted to strings as by String#valueOf(Object).

Returns:String

a string representation of this collection