Interface Range<T extends Number>

Type Parameters:
T - The type of bound

public interface Range<T extends Number>
Represents a range. The type is unbounded such that optional minima and maxima can be used.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Generates specific implementations of the Range interface.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Range<Double>
    doubleRange(@Nullable Double min, @Nullable Double max)
    Builds a Range based on doubles.
    static Range<Float>
    floatRange(@Nullable Float min, @Nullable Float max)
    Builds a Range based on floats.
    static Range<Integer>
    intRange(@Nullable Integer min, @Nullable Integer max)
    Builds a Range based on integers.
    @Nullable T
    max()
    Gets the maximum, if it exists.
    @Nullable T
    min()
    Gets the minimum, if it exists.
  • Method Details

    • floatRange

      static Range<Float> floatRange(@Nullable Float min, @Nullable Float max)
      Builds a Range based on floats.
      Parameters:
      min - The minimum, or null for no minimum
      max - The maximum, or null for no maximum
      Returns:
      The range.
    • intRange

      static Range<Integer> intRange(@Nullable Integer min, @Nullable Integer max)
      Builds a Range based on integers.
      Parameters:
      min - The minimum, or null for no minimum
      max - The maximum, or null for no maximum
      Returns:
      The range.
      Throws:
      IllegalArgumentException - if min is smaller than max
    • doubleRange

      static Range<Double> doubleRange(@Nullable Double min, @Nullable Double max)
      Builds a Range based on doubles.
      Parameters:
      min - The minimum, or null for no minimum
      max - The maximum, or null for no maximum
      Returns:
      The range.
    • min

      @Nullable T min()
      Gets the minimum, if it exists.
      Returns:
      The minimum.
    • max

      @Nullable T max()
      Gets the maximum, if it exists.
      Returns:
      The maximum