Interface InclusiveRange<T extends Comparable<T>>

Type Parameters:
T - the type of the range values
All Superinterfaces:
Wrapper

@NullMarked @AsOf("3.0.0") public interface InclusiveRange<T extends Comparable<T>> extends Wrapper
Represents a range of values with both ends inclusive.
Since:
3.0.0
  • Method Details

    • minInclusive

      @AsOf("3.0.0") T minInclusive()
      The minimum value in the range.
      Returns:
      the minimum value in the range
      Since:
      3.0.0
    • maxInclusive

      @AsOf("3.0.0") T maxInclusive()
      The maximum value in the range.
      Returns:
      the maximum value in the range
      Since:
      3.0.0
    • map

      @AsOf("3.0.0") default <S extends Comparable<S>> InclusiveRange<S> map(Function<? super T, ? extends S> mapper)
      Maps the range to a new type.
      Type Parameters:
      S - the type of the mapped values
      Parameters:
      mapper - the function to map the range values
      Returns:
      a new range with the mapped values
      Since:
      3.0.0
    • isValueInRange

      @AsOf("3.0.0") default boolean isValueInRange(T value)
      Checks if a value is within the range.
      Parameters:
      value - the value to check
      Returns:
      true if the value is within the range, false otherwise
      Since:
      3.0.0
    • contains

      @AsOf("3.0.0") default boolean contains(InclusiveRange<T> subRange)
      Checks if a range is within this range.
      Parameters:
      subRange - the range to check
      Returns:
      true if the range is within this range, false otherwise
      Since:
      3.0.0
    • of

      @AsOf("3.0.0") static <T extends Comparable<T>> InclusiveRange<T> of(T minInclusive, T maxInclusive)
      Creates a new instance.
      Type Parameters:
      T - the type of the range values
      Parameters:
      minInclusive - the minimum value in the range
      maxInclusive - the maximum value in the range
      Returns:
      a new instance
      Since:
      3.0.0
    • of

      @AsOf("3.0.0") static <T extends Comparable<T>> InclusiveRange<T> of(T value)
      Creates a new instance with the same min and max values.
      Type Parameters:
      T - the type of the range values
      Parameters:
      value - the value to use for both min and max
      Returns:
      a new instance
      Since:
      3.0.0