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.
    • Method Detail

      • 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