org.apache.myfaces.trinidad.util

## Class Range<C extends Comparable>

- java.lang.Object
- - org.apache.myfaces.trinidad.util.Range<C>

-     public final class Range<C extends Comparable>
      extends Object

  Represents a range of comparable values with a specific start and end. Range instances are constructed using the of() factory method. Range instances are immutable.

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `contains(C value)` Tests whether the specified value is contained within this range.
    `static <C extends Comparable> Range<C>` | `emptyRange()` Returns an empty range.
    `boolean` | `equals(Object o)`
    `C` | `getEnd()` Returns the end of the range.
    `C` | `getStart()` Returns the start of the range.
    `int` | `hashCode()`
    `Range<C>` | `intersect(Range<C> otherRange)` Computes the intersection of the this range with another range and returns the result in a new Range.
    `boolean` | `isEmpty()` Tests whether this range is empty.
    `static <C extends Comparable> Range<C>` | `of(C start, C end)` Returns a new range consisting of the specified start and end points.
    `String` | `toString()`

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

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

- - ### Method Detail

    - #### of

          public static <C extends Comparable> Range<C> of(C start,
                                           C end)

      Returns a new range consisting of the specified start and end points. If start > end, an empty range is returned.
      Throws:
        `IllegalArgumentException` - if start or end is null

    - #### emptyRange

          public static <C extends Comparable> Range<C> emptyRange()

      Returns an empty range.

    - #### getStart

          public C getStart()

      Returns the start of the range.

    - #### getEnd

          public C getEnd()

      Returns the end of the range.

    - #### isEmpty

          public boolean isEmpty()

      Tests whether this range is empty.
      Returns:
        true if empty, false otherwise

    - #### contains

          public boolean contains(C value)

      Tests whether the specified value is contained within this range.
      Parameters:
        `value` - the value to test
      Returns:
        true if the value is within this range, false otherwise.

    - #### intersect

          public Range<C> intersect(Range<C> otherRange)

      Computes the intersection of the this range with another range and returns the result in a new Range. If there is no intersection between the two ranges, the empty range (EMPTY_RANGE) is returned.
      Parameters:
        `otherRange` - the (non-null) range to intersect/update

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2001-2017 The Apache Software Foundation. All Rights Reserved.