Class Range<T>


  • public class Range<T>
    extends Object
    Range defines lower and upper boundaries to retrieve items from a sorted set.
    Since:
    4.3
    Author:
    Mark Paluch
    • Method Detail

      • create

        public static <T> Range<T> create​(T lower,
                                          T upper)
        Create a new range from lower and upper boundary values. Both values are included (greater than or equals and less than or equals).
        Type Parameters:
        T - value type
        Parameters:
        lower - lower boundary, must not be null.
        upper - upper boundary, must not be null.
        Returns:
        new Range
      • from

        public static <T> Range<T> from​(Range.Boundary<T> lower,
                                        Range.Boundary<T> upper)
        Create a new range from lower and upper boundaries.
        Type Parameters:
        T - value type.
        Parameters:
        lower - lower boundary, must not be null.
        upper - upper boundary, must not be null.
        Returns:
        new Range
      • gte

        public Range<T> gte​(T lower)
        Greater than or equals lower.
        Parameters:
        lower - the lower boundary value.
        Returns:
        this Range with lower applied.
      • gt

        public Range<T> gt​(T lower)
        Greater than lower.
        Parameters:
        lower - the lower boundary value.
        Returns:
        this Range with lower applied.
      • lte

        public Range<T> lte​(T upper)
        Less than or equals lower.
        Parameters:
        upper - the upper boundary value.
        Returns:
        this Range with upper applied.
      • lt

        public Range<T> lt​(T upper)
        Less than lower.
        Parameters:
        upper - the upper boundary value.
        Returns:
        this Range with upper applied.
      • isUnbounded

        public boolean isUnbounded()
        Return whether this Range is unbounded (i.e. upper and lower bounds are unbounded).
        Returns:
        whether this Range is unbounded
        Since:
        6.0
      • getLower

        public Range.Boundary<T> getLower()
        Returns:
        the lower boundary.
      • getUpper

        public Range.Boundary<T> getUpper()
        Returns:
        the upper boundary.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object