Package: groovy.lang

## [Java] Class ObjectRange

- groovy.lang.ObjectRange

- All Implemented Interfaces and Traits:
    Range

      public class ObjectRange
      extends AbstractList

  Represents an inclusive list of objects from a value to a value using comparators.

  Note: This class is similar to IntRange. If you make any changes to this class, you might consider making parallel changes to IntRange.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `ObjectRange (Comparable from, Comparable to)` Creates a new ObjectRange.
    `ObjectRange (Comparable from, Comparable to, boolean reverse)`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `boolean` | `contains(Object value)` iterates over all values and returns true if one value matches.
    `` | `boolean` | `containsWithinBounds(Object value)` Checks whether a value is between the from and to values of a Range
    `` | `protected Object` | `decrement(Object value)` Decrements by one
    `` | `boolean` | `equals(Object that)` {@inheritDoc}
    `` | `boolean` | `equals(ObjectRange that)` Compares an ObjectRange to another ObjectRange.
    `` | `Object` | `get(int index)` {@inheritDoc}
    `` | `Comparable` | `getFrom()` {@inheritDoc}
    `` | `Comparable` | `getTo()` {@inheritDoc}
    `` | `protected Object` | `increment(Object value)` Increments by one
    `` | `String` | `inspect()` {@inheritDoc}
    `` | `boolean` | `isReverse()` {@inheritDoc}
    `` | `Iterator` | `iterator()` {@inheritDoc}
    `` | `int` | `size()` {@inheritDoc}
    `` | `void` | `step(int step, Closure closure)` {@inheritDoc}
    `` | `List` | `step(int step)` {@inheritDoc}
    `` | `List` | `subList(int fromIndex, int toIndex)` {@inheritDoc}
    `` | `String` | `toString()` {@inheritDoc}

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---

    `class AbstractList`

    `remove, get, equals, hashCode, indexOf, clear, lastIndexOf, add, add, subList, iterator, addAll, set, listIterator, listIterator, remove, size, toString, isEmpty, toArray, toArray, contains, addAll, removeAll, retainAll, containsAll, getClass, notify, notifyAll, wait, wait, wait, toArray, stream, spliterator, removeIf, parallelStream, forEach, replaceAll, sort, getFirst, getLast, addFirst, addLast, removeFirst, removeLast, reversed, reversed`

    `class AbstractCollection` | `remove, size, toString, clear, isEmpty, add, toArray, toArray, iterator, contains, addAll, removeAll, retainAll, containsAll, equals, hashCode, getClass, notify, notifyAll, wait, wait, wait, toArray, stream, spliterator, removeIf, parallelStream, forEach`

- - ### Constructor Detail

    - #### public ObjectRange(Comparable from, Comparable to)

      Creates a new ObjectRange. Creates a reversed range if `from` < `to`.

      Parameters:
        `from` - the first value in the range.
        `to` - the last value in the range.

    - #### public ObjectRange(Comparable from, Comparable to, boolean reverse)

  - ### Method Detail

    - #### @Override public boolean contains(Object value)

      iterates over all values and returns true if one value matches. Also see containsWithinBounds.

    - #### @Override public boolean containsWithinBounds(Object value)

      Checks whether a value is between the from and to values of a Range

      Parameters:
        `value` - the value of interest
      Returns:
        true if the value is within the bounds

    - #### protected Object decrement(Object value)

      Decrements by one

      Parameters:
        `value` - the value to decrement
      Returns:
        the decremented value

    - #### public boolean equals(Object that)

      {@inheritDoc}

    - #### public boolean equals(ObjectRange that)

      Compares an ObjectRange to another ObjectRange.

      Parameters:
        `that` - the object to check equality with
      Returns:
        `true` if the ranges are equal

    - #### @Override public Object get(int index)

      {@inheritDoc}

    - #### @Override public Comparable getFrom()

      {@inheritDoc}

    - #### @Override public Comparable getTo()

      {@inheritDoc}

    - #### protected Object increment(Object value)

      Increments by one

      Parameters:
        `value` - the value to increment
      Returns:
        the incremented value

    - #### @Override public String inspect()

      {@inheritDoc}

    - #### @Override public boolean isReverse()

      {@inheritDoc}

    - #### public Iterator iterator()

      {@inheritDoc}

    - #### @Override public int size()

      {@inheritDoc}

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

      {@inheritDoc}

    - #### @Override public List step(int step)

      {@inheritDoc}

    - #### @Override public List subList(int fromIndex, int toIndex)

      {@inheritDoc}

    - #### public String toString()

      {@inheritDoc}