public class Range<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Range.Bound<T>
Value object representing a boundary.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> Range<T> |
closed(T from,
T to)
Creates a new
Range with inclusive bounds for both values. |
boolean |
contains(T value)
Returns whether the
Range contains the given value. |
boolean |
equals(Object o) |
Range.Bound<T> |
getLowerBound() |
Range.Bound<T> |
getUpperBound() |
int |
hashCode() |
static <T> Range<T> |
just(T value)
Creates a new Range with the given value as sole member.
|
static <T> Range<T> |
leftOpen(T from,
T to)
Creates a new left-open
Range, i.e. left exclusive, right inclusive. |
static <T> Range<T> |
leftUnbounded(Range.Bound<T> to)
Creates a left-unbounded
Range (the left bound set to Range.Bound.unbounded()) with the given right
bound. |
static <T> Range<T> |
of(Range.Bound<T> lowerBound,
Range.Bound<T> upperBound)
Creates a new
Range with the given lower and upper bound. |
static <T> Range<T> |
open(T from,
T to)
Creates a new
Range with exclusive bounds for both values. |
static <T> Range<T> |
rightOpen(T from,
T to)
Creates a new right-open
Range, i.e. left inclusive, right exclusive. |
static <T> Range<T> |
rightUnbounded(Range.Bound<T> from)
Creates a right-unbounded
Range (the right bound set to Range.Bound.unbounded()) with the given left
bound. |
String |
toString() |
static <T> Range<T> |
unbounded()
Returns an unbounded
Range. |
public static <T> Range<T> closed(T from, T to)
Range with inclusive bounds for both values.T - from - must not be null.to - must not be null.public static <T> Range<T> just(T value)
T - value - must not be null.Range#closed(T, T)public static <T> Range<T> leftOpen(T from, T to)
Range, i.e. left exclusive, right inclusive.T - from - must not be null.to - must not be null.public static <T> Range<T> leftUnbounded(Range.Bound<T> to)
Range (the left bound set to Range.Bound.unbounded()) with the given right
bound.T - to - the right Range.Bound, must not be null.public static <T> Range<T> of(Range.Bound<T> lowerBound, Range.Bound<T> upperBound)
Range with the given lower and upper bound.lowerBound - must not be null.upperBound - must not be null.public static <T> Range<T> open(T from, T to)
Range with exclusive bounds for both values.T - from - must not be null.to - must not be null.public static <T> Range<T> rightOpen(T from, T to)
Range, i.e. left inclusive, right exclusive.T - from - must not be null.to - must not be null.public static <T> Range<T> rightUnbounded(Range.Bound<T> from)
Range (the right bound set to Range.Bound.unbounded()) with the given left
bound.T - from - the left Range.Bound, must not be null.public boolean contains(T value)
Range contains the given value.value - must not be null.public Range.Bound<T> getLowerBound()
public Range.Bound<T> getUpperBound()
Copyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.