|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.common.collect.Ranges
@GwtCompatible @Beta public final class Ranges
Static methods pertaining to Range instances. Each of the
nine types of ranges can be constructed with a corresponding
factory method:
(a..b)
open(C, C)
[a..b]
closed(C, C)
[a..b)
closedOpen(C, C)
(a..b]
openClosed(C, C)
(a..+∞)
greaterThan(C)
[a..+∞)
atLeast(C)
(-∞..b)
lessThan(C)
(-∞..b]
atMost(C)
(-∞..+∞)
all()
Additionally, Range instances can be constructed by passing the
bound types explicitly.
range(C, com.google.common.collect.BoundType, C, com.google.common.collect.BoundType)
(a..+∞) or (a..+∞))
downTo(C, com.google.common.collect.BoundType)
(-∞..b) or (-∞..b])
upTo(C, com.google.common.collect.BoundType)
| Method Summary | ||
|---|---|---|
static
|
all()
Returns a range that contains every value of type C. |
|
static
|
atLeast(C endpoint)
Returns a range that contains all values greater than or equal to endpoint. |
|
static
|
atMost(C endpoint)
Returns a range that contains all values less than or equal to endpoint. |
|
static
|
closed(C lower,
C upper)
Returns a range that contains all values greater than or equal to lower and less than or equal to upper. |
|
static
|
closedOpen(C lower,
C upper)
Returns a range that contains all values greater than or equal to lower and strictly less than upper. |
|
static
|
downTo(C endpoint,
BoundType boundType)
Returns a range from the given endpoint, which may be either inclusive (closed) or exclusive (open), with no upper bound. |
|
static
|
encloseAll(Iterable<C> values)
Returns the minimal range that contains all of the given values. |
|
static
|
greaterThan(C endpoint)
Returns a range that contains all values strictly greater than endpoint. |
|
static
|
lessThan(C endpoint)
Returns a range that contains all values strictly less than endpoint. |
|
static
|
open(C lower,
C upper)
Returns a range that contains all values strictly greater than lower and strictly less than upper. |
|
static
|
openClosed(C lower,
C upper)
Returns a range that contains all values strictly greater than lower and less than or equal to upper. |
|
static
|
range(C lower,
BoundType lowerType,
C upper,
BoundType upperType)
Returns a range that contains any value from lower to upper, where each endpoint may be either inclusive (closed) or exclusive
(open). |
|
static
|
singleton(C value)
Returns a range that contains only the given value. |
|
static
|
upTo(C endpoint,
BoundType boundType)
Returns a range with no lower bound up to the given endpoint, which may be either inclusive (closed) or exclusive (open). |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <C extends Comparable<?>> Range<C> open(C lower,
C upper)
lower and strictly less than upper.
IllegalArgumentException - if lower is greater than or
equal to upper
public static <C extends Comparable<?>> Range<C> closed(C lower,
C upper)
lower and less than or equal to upper.
IllegalArgumentException - if lower is greater than upper
public static <C extends Comparable<?>> Range<C> closedOpen(C lower,
C upper)
lower and strictly less than upper.
IllegalArgumentException - if lower is greater than upper
public static <C extends Comparable<?>> Range<C> openClosed(C lower,
C upper)
lower and less than or equal to upper.
IllegalArgumentException - if lower is greater than upper
public static <C extends Comparable<?>> Range<C> range(C lower,
BoundType lowerType,
C upper,
BoundType upperType)
lower to upper, where each endpoint may be either inclusive (closed) or exclusive
(open).
IllegalArgumentException - if lower is greater than upperpublic static <C extends Comparable<?>> Range<C> lessThan(C endpoint)
endpoint.
public static <C extends Comparable<?>> Range<C> atMost(C endpoint)
endpoint.
public static <C extends Comparable<?>> Range<C> upTo(C endpoint,
BoundType boundType)
public static <C extends Comparable<?>> Range<C> greaterThan(C endpoint)
endpoint.
public static <C extends Comparable<?>> Range<C> atLeast(C endpoint)
endpoint.
public static <C extends Comparable<?>> Range<C> downTo(C endpoint,
BoundType boundType)
public static <C extends Comparable<?>> Range<C> all()
C.
public static <C extends Comparable<?>> Range<C> singleton(C value)
public static <C extends Comparable<?>> Range<C> encloseAll(Iterable<C> values)
ClassCastException - if the parameters are not mutually
comparable
NoSuchElementException - if values is empty
NullPointerException - if any of values is null
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||