Module lettuce.core

Class Range<T>

java.lang.Object
io.lettuce.core.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 Details

    • 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
    • unbounded

      public static <T> Range<T> unbounded()
      Type Parameters:
      T - value type.
      Returns:
      new Range with lower and upper set to Range.Boundary.unbounded().
    • 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.
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object