Class LongRange

All Implemented Interfaces:
Serializable

public final class LongRange extends NumberRange<Long>
Specializes NumberRange for Longs.

This class is not designed to interoperate with other NumberRanges

Since:
3.13.0
See Also:
  • Field Details

  • Constructor Details

    • LongRange

      private LongRange(Long number1, Long number2)
      Creates an instance.
      Parameters:
      number1 - the first element, not null
      number2 - the second element, not null
      Throws:
      NullPointerException - when element1 is null.
      NullPointerException - when element2 is null.
  • Method Details

    • of

      public static LongRange of(long fromInclusive, long toInclusive)
      Creates a range with the specified minimum and maximum values (both inclusive).

      The range uses the natural ordering of the elements to determine where values lie in the range.

      The arguments may be passed in the order (min,max) or (max,min). The getMinimum and getMaximum methods will return the correct values.

      Parameters:
      fromInclusive - the first value that defines the edge of the range, inclusive.
      toInclusive - the second value that defines the edge of the range, inclusive.
      Returns:
      the range object, not null.
    • of

      public static LongRange of(Long fromInclusive, Long toInclusive)
      Creates a range with the specified minimum and maximum values (both inclusive).

      The range uses the natural ordering of the elements to determine where values lie in the range.

      The arguments may be passed in the order (min,max) or (max,min). The getMinimum and getMaximum methods will return the correct values.

      Parameters:
      fromInclusive - the first value that defines the edge of the range, inclusive.
      toInclusive - the second value that defines the edge of the range, inclusive.
      Returns:
      the range object, not null.
      Throws:
      IllegalArgumentException - if either element is null.