Groovy Documentation

groovy.lang
[Java] Class EmptyRange

java.lang.Object
  java.util.AbstractCollection
      java.util.AbstractList
          groovy.lang.EmptyRange
All Implemented Interfaces:
Range

public class EmptyRange
extends java.util.AbstractList

Constructing Ranges like 0..<0

Authors:
Dierk Koenig
Edwin Tellman


Field Summary
protected java.lang.Comparable at

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

 
Constructor Summary
EmptyRange(java.lang.Comparable at)

Creates a new EmptyRange.

 
Method Summary
boolean add(java.lang.Object o)

Always throws UnsupportedOperationException for an empty range.

boolean addAll(int index, java.util.Collection c)

Always throws UnsupportedOperationException for an empty range.

boolean addAll(java.util.Collection c)

Always throws UnsupportedOperationException for an empty range.

boolean containsWithinBounds(java.lang.Object o)

Never true for an empty range.

java.lang.Object get(int index)

Always throws IndexOutOfBoundsException for an empty range.

java.lang.Comparable getFrom()

{@inheritDoc}

java.lang.Comparable getTo()

{@inheritDoc}

java.lang.String inspect()

{@inheritDoc}

boolean isReverse()

Never true for an empty range.

boolean remove(java.lang.Object o)

Always throws UnsupportedOperationException for an empty range.

java.lang.Object remove(int index)

Always throws UnsupportedOperationException for an empty range.

boolean removeAll(java.util.Collection c)

Always throws UnsupportedOperationException for an empty range.

boolean retainAll(java.util.Collection c)

Always throws UnsupportedOperationException for an empty range.

java.lang.Object set(int index, java.lang.Object element)

Always throws UnsupportedOperationException for an empty range.

int size()

Always 0 for an empty range.

void step(int step, Closure closure)

Always does nothing for an empty range.

java.util.List step(int step)

Always returns an empty list for an empty range.

java.lang.String toString()

{@inheritDoc}

 
Methods inherited from class java.util.AbstractList
java.util.AbstractList#add(int, java.lang.Object), java.util.AbstractList#add(java.lang.Object), java.util.AbstractList#remove(int), java.util.AbstractList#get(int), java.util.AbstractList#equals(java.lang.Object), java.util.AbstractList#hashCode(), java.util.AbstractList#indexOf(java.lang.Object), java.util.AbstractList#clear(), java.util.AbstractList#lastIndexOf(java.lang.Object), java.util.AbstractList#subList(int, int), java.util.AbstractList#addAll(int, java.util.Collection), java.util.AbstractList#iterator(), java.util.AbstractList#set(int, java.lang.Object), java.util.AbstractList#listIterator(), java.util.AbstractList#listIterator(int), java.util.AbstractList#remove(java.lang.Object), java.util.AbstractList#toString(), java.util.AbstractList#contains(java.lang.Object), java.util.AbstractList#isEmpty(), java.util.AbstractList#size(), java.util.AbstractList#toArray([Ljava.lang.Object;), java.util.AbstractList#toArray(), java.util.AbstractList#addAll(java.util.Collection), java.util.AbstractList#retainAll(java.util.Collection), java.util.AbstractList#containsAll(java.util.Collection), java.util.AbstractList#removeAll(java.util.Collection), java.util.AbstractList#wait(long, int), java.util.AbstractList#wait(long), java.util.AbstractList#wait(), java.util.AbstractList#getClass(), java.util.AbstractList#notify(), java.util.AbstractList#notifyAll(), java.util.AbstractList#size()
 
Methods inherited from class java.util.AbstractCollection
java.util.AbstractCollection#add(java.lang.Object), java.util.AbstractCollection#remove(java.lang.Object), java.util.AbstractCollection#toString(), java.util.AbstractCollection#clear(), java.util.AbstractCollection#contains(java.lang.Object), java.util.AbstractCollection#isEmpty(), java.util.AbstractCollection#size(), java.util.AbstractCollection#toArray([Ljava.lang.Object;), java.util.AbstractCollection#toArray(), java.util.AbstractCollection#addAll(java.util.Collection), java.util.AbstractCollection#iterator(), java.util.AbstractCollection#retainAll(java.util.Collection), java.util.AbstractCollection#containsAll(java.util.Collection), java.util.AbstractCollection#removeAll(java.util.Collection), java.util.AbstractCollection#wait(long, int), java.util.AbstractCollection#wait(long), java.util.AbstractCollection#wait(), java.util.AbstractCollection#equals(java.lang.Object), java.util.AbstractCollection#hashCode(), java.util.AbstractCollection#getClass(), java.util.AbstractCollection#notify(), java.util.AbstractCollection#notifyAll()
 

Field Detail

at

protected java.lang.Comparable at
The value at which the range originates (may be null).


 
Constructor Detail

EmptyRange

public EmptyRange(java.lang.Comparable at)
Creates a new EmptyRange.
Parameters:
at - the value at which the range starts (may be null).


 
Method Detail

add

public boolean add(java.lang.Object o)
Always throws UnsupportedOperationException for an empty range.
throws:
UnsupportedOperationException always


addAll

public boolean addAll(int index, java.util.Collection c)
Always throws UnsupportedOperationException for an empty range.
throws:
UnsupportedOperationException


addAll

public boolean addAll(java.util.Collection c)
Always throws UnsupportedOperationException for an empty range.
throws:
UnsupportedOperationException


containsWithinBounds

public boolean containsWithinBounds(java.lang.Object o)
Never true for an empty range.
Returns:
false


get

public java.lang.Object get(int index)
Always throws IndexOutOfBoundsException for an empty range.
throws:
IndexOutOfBoundsException always


getFrom

public java.lang.Comparable getFrom()
{@inheritDoc}


getTo

public java.lang.Comparable getTo()
{@inheritDoc}


inspect

public java.lang.String inspect()
{@inheritDoc}


isReverse

public boolean isReverse()
Never true for an empty range.
Returns:
false


remove

public boolean remove(java.lang.Object o)
Always throws UnsupportedOperationException for an empty range.
throws:
UnsupportedOperationException


remove

public java.lang.Object remove(int index)
Always throws UnsupportedOperationException for an empty range.
throws:
UnsupportedOperationException


removeAll

public boolean removeAll(java.util.Collection c)
Always throws UnsupportedOperationException for an empty range.
throws:
UnsupportedOperationException


retainAll

public boolean retainAll(java.util.Collection c)
Always throws UnsupportedOperationException for an empty range.
throws:
UnsupportedOperationException


set

public java.lang.Object set(int index, java.lang.Object element)
Always throws UnsupportedOperationException for an empty range.
throws:
UnsupportedOperationException


size

public int size()
Always 0 for an empty range.
Returns:
0


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.


toString

public java.lang.String toString()
{@inheritDoc}


 

Groovy Documentation