Package: groovy.lang

## [Java] Class EmptyRange<T extends Comparable>

- groovy.lang.EmptyRange

- All Implemented Interfaces and Traits:
    Range

      public class EmptyRange<T extends Comparable>
      extends AbstractList
      implements Range

  Constructing Ranges like 0..<0

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected T` | `at` | The value at which the range originates (may be `null`).

  - ### Constructor Summary

    Constructors
    Constructor and description
    `EmptyRange(T at)` Creates a new EmptyRange.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `add(T o)` Always throws `UnsupportedOperationException` for an empty range.
    `` | `public boolean` | `addAll(int index, Collection<? extends T> c)` Always throws `UnsupportedOperationException` for an empty range.
    `` | `public boolean` | `addAll(Collection<? extends T> c)` Always throws `UnsupportedOperationException` for an empty range.
    `` | `public boolean` | `containsWithinBounds(Object o)` Never true for an empty range.
    `` | `public T` | `get(int index)` Always throws `IndexOutOfBoundsException` for an empty range.
    `` | `public T` | `getFrom()` * The lower value in the range. * * Returns: the lower value in the range.
    `` | `public T` | `getTo()` * The upper value in the range. * * Returns: the upper value in the range
    `` | `public String` | `inspect()` * Returns: the verbose String representation of this Range as would be typed into a console to create the Range instance
    `` | `public boolean` | `isReverse()` Never true for an empty range.
    `` | `public boolean` | `remove(Object o)` Always throws `UnsupportedOperationException` for an empty range.
    `` | `public T` | `remove(int index)` Always throws `UnsupportedOperationException` for an empty range.
    `` | `public boolean` | `removeAll(Collection<?> c)` Always throws `UnsupportedOperationException` for an empty range.
    `` | `public boolean` | `retainAll(Collection<?> c)` Always throws `UnsupportedOperationException` for an empty range.
    `` | `public T` | `set(int index, T element)` Always throws `UnsupportedOperationException` for an empty range.
    `` | `public int` | `size()` Always 0 for an empty range.
    `` | `public void` | `step(int step, Closure closure)` Always does nothing for an empty range.
    `` | `public List<T>` | `step(int step)` Always returns an empty list for an empty range.
    `` | `public String` | `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. Returns: a string representation of this collection

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AbstractList` | `add, add, addAll, addAll, clear, contains, containsAll, equals, forEach, get, getClass, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, notify, notifyAll, parallelStream, remove, remove, removeAll, removeIf, replaceAll, retainAll, set, size, sort, spliterator, stream, subList, toArray, toArray, toArray, toString, wait, wait, wait`

- - ### Field Detail

    - #### protected T at

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

  - ### Constructor Detail

    - #### public EmptyRange(T at)

      Creates a new EmptyRange.

      Parameters:
        `at` - the value at which the range starts (may be `null`).

  - ### Method Detail

    - #### public boolean add(T o)

      Always throws `UnsupportedOperationException` for an empty range.

      throws:
        UnsupportedOperationException always

    - #### public boolean addAll(int index, Collection<? extends T> c)

      Always throws `UnsupportedOperationException` for an empty range.

      throws:
        UnsupportedOperationException

    - #### public boolean addAll(Collection<? extends T> c)

      Always throws `UnsupportedOperationException` for an empty range.

      throws:
        UnsupportedOperationException

    - #### public boolean containsWithinBounds(Object o)

      Never true for an empty range.

      Returns:
        `false`

    - #### public T get(int index)

      Always throws `IndexOutOfBoundsException` for an empty range.

      throws:
        IndexOutOfBoundsException always

    - #### public T getFrom()

      * The lower value in the range. * *

      Returns:
        the lower value in the range.

    - #### public T getTo()

      * The upper value in the range. * *

      Returns:
        the upper value in the range

    - #### public String inspect()

      *

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

    - #### public boolean isReverse()

      Never true for an empty range.

      Returns:
        `false`

    - #### public boolean remove(Object o)

      Always throws `UnsupportedOperationException` for an empty range.

      throws:
        UnsupportedOperationException

    - #### public T remove(int index)

      Always throws `UnsupportedOperationException` for an empty range.

      throws:
        UnsupportedOperationException

    - #### public boolean removeAll(Collection<?> c)

      Always throws `UnsupportedOperationException` for an empty range.

      throws:
        UnsupportedOperationException

    - #### public boolean retainAll(Collection<?> c)

      Always throws `UnsupportedOperationException` for an empty range.

      throws:
        UnsupportedOperationException

    - #### public T set(int index, T element)

      Always throws `UnsupportedOperationException` for an empty range.

      throws:
        UnsupportedOperationException

    - #### public int size()

      Always 0 for an empty range.

      Returns:
        0

    - #### public void step(int step, Closure closure)

      Always does nothing for an empty range.

    - #### public List<T> step(int step)

      Always returns an empty list for an empty range.

    - #### public String 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.

      Returns:
        a string representation of this collection