Interface Range<T>

Type Parameters:
T - type of value limited by this range.
All Superinterfaces:
Predicate<T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Range<T> extends Predicate<T>
Range limiting some value.
  • Method Details

    • includes

      default boolean includes(T value)
      Checks if the given value is in range.
      Parameters:
      value - value checked for inclusion in this range
      Returns:
      true if the range includes the given value and false otherwise
    • negate

      @NotNull default @NotNull Range<T> negate()
      Specified by:
      negate in interface Predicate<T>
    • and

      @NotNull default @NotNull Range<T> and(@NonNull @NonNull Predicate<? super T> other)
      Specified by:
      and in interface Predicate<T>
    • or

      @NotNull default @NotNull Range<T> or(@NonNull @NonNull Predicate<? super T> other)
      Specified by:
      or in interface Predicate<T>
    • any

      @NotNull static <T> @NotNull Range<T> any()
      Creates a range [-∞ ; +∞].
      Type Parameters:
      T - type of range's elements
      Returns:
      created range
    • none

      @NotNull static <T> @NotNull Range<T> none()
      Creates a range .
      Type Parameters:
      T - type of range's elements
      Returns:
      created range
    • onlyNull

      @NotNull static <T> @NotNull Range<T> onlyNull()
      Creates a range {null}.
      Type Parameters:
      T - type of range's elements
      Returns:
      created range
    • only

      @NotNull static <T> @NotNull Range<T> only(@Ref T value)
      Creates a range {value}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      value - the only value contained by the range
      Returns:
      created range
    • only

      @SafeVarargs @NotNull static <T> @NotNull Range<T> only(@Own T @Own @NonNull ... values)
      Creates a range {x: x ∈ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values contained by the range
      Returns:
      created range
      API note
      this takes ownership over values
    • only

      @NotNull static <T> @NotNull Range<T> only(@NonNull @Ref @NonNull Collection<T> values)
      Creates a range {x: x ∈ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values contained by the range
      Returns:
      created range
      API note
      this takes ownership over values
    • onlyCopy

      @SafeVarargs @NotNull static <T> @NotNull Range<T> onlyCopy(@Own T @Ref @NonNull ... values)
      Creates a range {x: x ∈ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values contained by the range
      Returns:
      created range
      API note
      this copies values not preserving order
    • onlyCopy

      @NotNull static <T> @NotNull Range<T> onlyCopy(@NonNull @Ref @NonNull Collection<T> values)
      Creates a range {x: x ∈ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values contained by the range
      Returns:
      created range
      API note
      this copies values not preserving order
    • onlyCopyOrdered

      @NotNull static <T> @NotNull Range<T> onlyCopyOrdered(@NonNull @Ref @NonNull Collection<T> values)
      Creates a range {x: x ∈ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values contained by the range
      Returns:
      created range
      API note
      this copies values preserving order
    • exceptNull

      @NotNull static <T> @NotNull Range<T> exceptNull()
      Creates a range ¬{null}.
      Type Parameters:
      T - type of range's elements
      Returns:
      created range
    • except

      @NotNull static <T> @NotNull Range<T> except(@Ref T value)
      Creates a range ¬{value}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      value - the only value not contained by the range
      Returns:
      created range
    • except

      @SafeVarargs @NotNull static <T> @NotNull Range<T> except(@Own T @Own @NonNull ... values)
      Creates a range {x: x ∉ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values not contained by the range
      Returns:
      created range
      API note
      this takes ownership over values
    • except

      @NotNull static <T> @NotNull Range<T> except(@NonNull @Ref @NonNull Collection<T> values)
      Creates a range {x: x ∉ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values not contained by the range
      Returns:
      created range
      API note
      this takes ownership over values
    • exceptCopy

      @SafeVarargs @NotNull static <T> @NotNull Range<T> exceptCopy(@Own T @Own @NonNull ... values)
      Creates a range {x: x ∉ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values not contained by the range
      Returns:
      created range
      API note
      this copies values not preserving order
    • exceptCopy

      @NotNull static <T> @NotNull Range<T> exceptCopy(@NonNull @Ref @NonNull Collection<T> values)
      Creates a range {x: x ∉ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values not contained by the range
      Returns:
      created range
      API note
      this copies values not preserving order
    • exceptCopyOrdered

      @NotNull static <T> @NotNull Range<T> exceptCopyOrdered(@NonNull @Ref @NonNull Collection<T> values)
      Creates a range {x: x ∉ values}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      values - the only values not contained by the range
      Returns:
      created range
      API note
      this copies values preserving order
    • greater

      @NotNull static <T extends Comparable<T>> @NotNull Range<T> greater(@NonNull @Ref T lowerBound)
      Creates a range (lowerBound; +∞).
      Type Parameters:
      T - type of range's elements
      Parameters:
      lowerBound - lower exclusive bound of the range
      Returns:
      created range
    • greaterOrEqual

      @NotNull static <T extends Comparable<T>> @NotNull Range<T> greaterOrEqual(@NonNull @Ref T lowerBound)
      Creates a range [lowerBound; +∞).
      Type Parameters:
      T - type of range's elements
      Parameters:
      lowerBound - lower inclusive bound of the range
      Returns:
      created range
    • less

      @NotNull static <T extends Comparable<T>> @NotNull Range<T> less(@NonNull @Ref T upperBound)
      Creates a range (∞; upperBound).
      Type Parameters:
      T - type of range's elements
      Parameters:
      upperBound - upper inclusive bound of the range
      Returns:
      created range
    • lessOrEqual

      @NotNull static <T extends Comparable<T>> @NotNull Range<T> lessOrEqual(@NonNull @Ref T upperBound)
      Creates a range (∞; upperBound].
      Type Parameters:
      T - type of range's elements
      Parameters:
      upperBound - upper exclusive bound of the range
      Returns:
      created range
    • between

      @NotNull static <T extends Comparable<T>> @NotNull Range<T> between(@NonNull @Ref T lowerBound, @NonNull @Ref T upperBound)
      Creates a range (lowerBound; upperBound).
      Type Parameters:
      T - type of range's elements
      Parameters:
      lowerBound - lower exclusive bound of the range
      upperBound - upper exclusive bound of the range
      Returns:
      created range
    • betweenOrEqual

      @NotNull static <T extends Comparable<T>> @NotNull Range<T> betweenOrEqual(@NonNull @Ref T lowerBound, @NonNull @Ref T upperBound)
      Creates a range [lowerBound; upperBound].
      Type Parameters:
      T - type of range's elements
      Parameters:
      lowerBound - lower inclusive bound of the range
      upperBound - upper inclusive bound of the range
      Returns:
      created range
    • fromExclusiveTo

      @NotNull static <T extends Comparable<T>> @NotNull Range<T> fromExclusiveTo(@NonNull @Ref T lowerBound, @NonNull @Ref T upperBound)
      Creates a range (lowerBound; upperBound].
      Type Parameters:
      T - type of range's elements
      Parameters:
      lowerBound - lower exclusive bound of the range
      upperBound - upper inclusive bound of the range
      Returns:
      created range
    • fromToExclusive

      @NotNull static <T extends Comparable<T>> @NotNull Range<T> fromToExclusive(@NonNull @Ref T lowerBound, @NonNull @Ref T upperBound)
      Creates a range [lowerBound; upperBound).
      Type Parameters:
      T - type of range's elements
      Parameters:
      lowerBound - lower inclusive bound of the range
      upperBound - upper exclusive bound of the range
      Returns:
      created range
    • anyOf

      @SafeVarargs @NotNull static <T> @NotNull Range<T> anyOf(@NotNull @Ref @NotNull Range<T> @NonNull ... ranges)
      Creates a range {x: ∃ range ∈ ranges: x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched disjunctive ranges
      Returns:
      created range
      API note
      this takes ownership over ranges
    • anyOf

      @NotNull static <T> @NotNull Range<T> anyOf(@NonNull @Ref @NonNull Iterable<@NotNull Range<T>> ranges)
      Creates a range {x: ∃ range ∈ ranges: x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched disjunctive ranges
      Returns:
      created range
      API note
      this takes ownership over ranges
    • anyOfCopy

      @SafeVarargs @NotNull static <T> @NotNull Range<T> anyOfCopy(@NotNull @Ref @NotNull Range<T> @NonNull ... ranges)
      Creates a range {x: ∃ range ∈ ranges: x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched disjunctive ranges
      Returns:
      created range
      API note
      this copies ranges preserving order
    • anyOfCopy

      @NotNull static <T> @NotNull Range<T> anyOfCopy(@NonNull @Ref @NonNull Iterable<@NotNull Range<T>> ranges)
      Creates a range {x: ∃ range ∈ ranges: x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched disjunctive ranges
      Returns:
      created range
      API note
      this copies ranges not preserving order
    • anyOfCopyOrdered

      @NotNull static <T> @NotNull Range<T> anyOfCopyOrdered(@NonNull @Ref @NonNull Iterable<@NotNull Range<T>> ranges)
      Creates a range {x: ∃ range ∈ ranges: x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched disjunctive ranges
      Returns:
      created range
      API note
      this copies ranges preserving order
    • allOf

      @SafeVarargs @NotNull static <T> @NotNull Range<T> allOf(@NotNull @Ref @NotNull Range<T> @NonNull ... ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched conjunctive ranges
      Returns:
      created range
      API note
      this takes ownership over ranges
    • allOf

      @NotNull static <T> @NotNull Range<T> allOf(@NonNull @Ref @NonNull Iterable<@NotNull Range<T>> ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched conjunctive ranges
      Returns:
      created range
      API note
      this takes ownership over ranges
    • allOfCopy

      @SafeVarargs @NotNull static <T> @NotNull Range<T> allOfCopy(@NotNull @Ref @NotNull Range<T> @NonNull ... ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched conjunctive ranges
      Returns:
      created range
      API note
      this copies ranges preserving order
    • allOfCopy

      @NotNull static <T> @NotNull Range<T> allOfCopy(@NonNull @Ref @NonNull Iterable<@NotNull Range<T>> ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched conjunctive ranges
      Returns:
      created range
      API note
      this copies ranges not preserving order
    • allOfCopyOrdered

      @NotNull static <T> @NotNull Range<T> allOfCopyOrdered(@NonNull @Ref @NonNull Iterable<@NotNull Range<T>> ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∈ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - matched conjunctive ranges
      Returns:
      created range
      API note
      this copies ranges preserving order
    • noneOf

      @SafeVarargs @NotNull static <T> @NotNull Range<T> noneOf(@NotNull @Ref @NotNull Range<T> @NonNull ... ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∉ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - not matched conjunctive ranges
      Returns:
      created range
      API note
      this takes ownership over ranges
    • noneOf

      @NotNull static <T> @NotNull Range<T> noneOf(@NonNull @Ref @NonNull Iterable<@NotNull Range<T>> ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∉ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - not matched conjunctive ranges
      Returns:
      created range
      API note
      this takes ownership over ranges
    • noneOfCopy

      @SafeVarargs @NotNull static <T> @NotNull Range<T> noneOfCopy(@NotNull @Ref @NotNull Range<T> @NonNull ... ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∉ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - not matched conjunctive ranges
      Returns:
      created range
      API note
      this copies ranges preserving order
    • noneOfCopy

      @NotNull static <T> @NotNull Range<T> noneOfCopy(@NonNull @Ref @NonNull Iterable<@NotNull Range<T>> ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∉ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - not matched conjunctive ranges
      Returns:
      created range
      API note
      this copies ranges not preserving order
    • noneOfCopyOrdered

      @NotNull static <T> @NotNull Range<T> noneOfCopyOrdered(@NonNull @Ref @NonNull Iterable<@NotNull Range<T>> ranges)
      Creates a range {x: ∀ range ∈ ranges, x ∉ range}.
      Type Parameters:
      T - type of range's elements
      Parameters:
      ranges - not matched conjunctive ranges
      Returns:
      created range
      API note
      this copies ranges preserving order