Groovy 2.2.0

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 AbstractList

Constructing Ranges like 0..<0

Authors:
Dierk Koenig
Edwin Tellman


Field Summary
protected Comparable at

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

 
Constructor Summary
EmptyRange(Comparable at)

Creates a new EmptyRange.

 
Method Summary
boolean add(Object o)

Always throws UnsupportedOperationException for an empty range.

boolean addAll(int index, Collection c)

Always throws UnsupportedOperationException for an empty range.

boolean addAll(Collection c)

Always throws UnsupportedOperationException for an empty range.

boolean containsWithinBounds(Object o)

Never true for an empty range.

Object get(int index)

Always throws IndexOutOfBoundsException for an empty range.

Comparable getFrom()

{@inheritDoc}

Comparable getTo()

{@inheritDoc}

String inspect()

{@inheritDoc}

boolean isReverse()

Never true for an empty range.

boolean remove(Object o)

Always throws UnsupportedOperationException for an empty range.

Object remove(int index)

Always throws UnsupportedOperationException for an empty range.

boolean removeAll(Collection c)

Always throws UnsupportedOperationException for an empty range.

boolean retainAll(Collection c)

Always throws UnsupportedOperationException for an empty range.

Object set(int index, 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.

List step(int step)

Always returns an empty list for an empty range.

String toString()

{@inheritDoc}

 
Methods inherited from class AbstractList
add, add, remove, get, equals, hashCode, indexOf, clear, lastIndexOf, subList, addAll, iterator, set, listIterator, listIterator, remove, toString, contains, isEmpty, size, toArray, toArray, addAll, retainAll, containsAll, removeAll, wait, wait, wait, getClass, notify, notifyAll, size
 
Methods inherited from class AbstractCollection
add, remove, toString, clear, contains, isEmpty, size, toArray, toArray, addAll, iterator, retainAll, containsAll, removeAll, wait, wait, wait, equals, hashCode, getClass, notify, notifyAll
 

Field Detail

at

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


 
Constructor Detail

EmptyRange

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


 
Method Detail

add

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


addAll

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


addAll

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


containsWithinBounds

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


get

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


getFrom

public Comparable getFrom()
{@inheritDoc}


getTo

public Comparable getTo()
{@inheritDoc}


inspect

public String inspect()
{@inheritDoc}


isReverse

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


remove

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


remove

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


removeAll

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


retainAll

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


set

public Object set(int index, 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 List step(int step)
Always returns an empty list for an empty range.


toString

public String toString()
{@inheritDoc}


 

Copyright &copy; 2003-2013 The Codehaus. All rights reserved.