Class IntegerRange

All Implemented Interfaces:
Serializable

public final class IntegerRange extends NumberRange<Integer>
Specializes NumberRange for Integers.

This class is not designed to interoperate with other NumberRanges

Since:
3.13.0
See Also:
  • Method Details Link icon

    • of Link icon

      public static IntegerRange of(int fromInclusive, int toInclusive)
      Creates a closed 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 Link icon

      public static IntegerRange of(Integer fromInclusive, Integer toInclusive)
      Creates a closed 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.
    • toIntStream Link icon

      Returns a sequential ordered IntStream from Range.getMinimum() (inclusive) to Range.getMaximum() (inclusive) by an incremental step of 1.
      Returns:
      a sequential IntStream for the range of int elements
      Since:
      3.18.0