groovy.lang

## Class EmptyRange

- java.lang.Object
- - java.util.AbstractCollection<E>
  - - java.util.AbstractList
    - - groovy.lang.EmptyRange

- All Implemented Interfaces:
    Range, java.lang.Iterable, java.util.Collection, java.util.List

      public class EmptyRange
      extends java.util.AbstractList
      implements Range

  Constructing Ranges like 0..<0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Comparable` | `at` The value at which the range originates (may be `null`).

    - ### Fields inherited from class java.util.AbstractList

      `modCount`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EmptyRange(java.lang.Comparable at)` Creates a new `EmptyRange`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(java.lang.Object o)` Always throws `UnsupportedOperationException` for an empty range.
    `boolean` | `addAll(java.util.Collection c)` Always throws `UnsupportedOperationException` for an empty range.
    `boolean` | `addAll(int index, 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()` The lower value in the range.
    `java.lang.Comparable` | `getTo()` The upper value in the range.
    `java.lang.String` | `inspect()`
    `boolean` | `isReverse()` Never true for an empty range.
    `java.lang.Object` | `remove(int index)` Always throws `UnsupportedOperationException` for an empty range.
    `boolean` | `remove(java.lang.Object o)` 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.
    `java.util.List` | `step(int step)` Always returns an empty list for an empty range.
    `void` | `step(int step, Closure closure)` Always does nothing for an empty range.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.util.AbstractList

      `add, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList`

    - ### Methods inherited from class java.util.AbstractCollection

      `contains, containsAll, isEmpty, toArray, toArray`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.List

      `add, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, replaceAll, sort, spliterator, subList, toArray, toArray`

    - ### Methods inherited from interface java.util.Collection

      `parallelStream, removeIf, stream`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### 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

    - #### getFrom

          public java.lang.Comparable getFrom()

      The lower value in the range.
      Specified by:
        `getFrom` in interface `Range`
      Returns:
        the lower value in the range.

    - #### getTo

          public java.lang.Comparable getTo()

      The upper value in the range.
      Specified by:
        `getTo` in interface `Range`
      Returns:
        the upper value in the range

    - #### isReverse

          public boolean isReverse()

      Never true for an empty range.
      Specified by:
        `isReverse` in interface `Range`
      Returns:
        `false`

    - #### containsWithinBounds

          public boolean containsWithinBounds(java.lang.Object o)

      Never true for an empty range.
      Specified by:
        `containsWithinBounds` in interface `Range`
      Parameters:
        `o` - the object to check against the boundaries of the range
      Returns:
        `false`

    - #### inspect

          public java.lang.String inspect()

      Specified by:
        `inspect` in interface `Range`
      Returns:
        the verbose `String` representation of this `Range` as would be typed into a console to create the `Range` instance

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.util.AbstractCollection`

    - #### size

          public int size()

      Always 0 for an empty range.
      Specified by:
        `size` in interface `java.util.Collection`
      Specified by:
        `size` in interface `java.util.List`
      Specified by:
        `size` in class `java.util.AbstractCollection`
      Returns:
        0

    - #### get

          public java.lang.Object get(int index)

      Always throws `IndexOutOfBoundsException` for an empty range.
      Specified by:
        `get` in interface `java.util.List`
      Specified by:
        `get` in class `java.util.AbstractList`
      Throws:
        `java.lang.IndexOutOfBoundsException` - always

    - #### add

          public boolean add(java.lang.Object o)

      Always throws `UnsupportedOperationException` for an empty range.
      Specified by:
        `add` in interface `java.util.Collection`
      Specified by:
        `add` in interface `java.util.List`
      Overrides:
        `add` in class `java.util.AbstractList`
      Throws:
        `java.lang.UnsupportedOperationException` - always

    - #### addAll

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

      Always throws `UnsupportedOperationException` for an empty range.
      Specified by:
        `addAll` in interface `java.util.List`
      Overrides:
        `addAll` in class `java.util.AbstractList`
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### addAll

          public boolean addAll(java.util.Collection c)

      Always throws `UnsupportedOperationException` for an empty range.
      Specified by:
        `addAll` in interface `java.util.Collection`
      Specified by:
        `addAll` in interface `java.util.List`
      Overrides:
        `addAll` in class `java.util.AbstractCollection`
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### remove

          public boolean remove(java.lang.Object o)

      Always throws `UnsupportedOperationException` for an empty range.
      Specified by:
        `remove` in interface `java.util.Collection`
      Specified by:
        `remove` in interface `java.util.List`
      Overrides:
        `remove` in class `java.util.AbstractCollection`
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### remove

          public java.lang.Object remove(int index)

      Always throws `UnsupportedOperationException` for an empty range.
      Specified by:
        `remove` in interface `java.util.List`
      Overrides:
        `remove` in class `java.util.AbstractList`
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### removeAll

          public boolean removeAll(java.util.Collection c)

      Always throws `UnsupportedOperationException` for an empty range.
      Specified by:
        `removeAll` in interface `java.util.Collection`
      Specified by:
        `removeAll` in interface `java.util.List`
      Overrides:
        `removeAll` in class `java.util.AbstractCollection`
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### retainAll

          public boolean retainAll(java.util.Collection c)

      Always throws `UnsupportedOperationException` for an empty range.
      Specified by:
        `retainAll` in interface `java.util.Collection`
      Specified by:
        `retainAll` in interface `java.util.List`
      Overrides:
        `retainAll` in class `java.util.AbstractCollection`
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### set

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

      Always throws `UnsupportedOperationException` for an empty range.
      Specified by:
        `set` in interface `java.util.List`
      Overrides:
        `set` in class `java.util.AbstractList`
      Throws:
        `java.lang.UnsupportedOperationException`

    - #### step

          public void step(int step,
                           Closure closure)

      Always does nothing for an empty range.
      Specified by:
        `step` in interface `Range`
      Parameters:
        `step` - the amount by which to step. If negative, steps through the range backwards.
        `closure` - the `Closure` to call

    - #### step

          public java.util.List step(int step)

      Always returns an empty list for an empty range.
      Specified by:
        `step` in interface `Range`
      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.