Package com.google.common.collect
Class Ranges
- java.lang.Object
-
- com.google.common.collect.Ranges
-
@Deprecated @GwtCompatible @Beta public final class Ranges extends java.lang.Object
Deprecated.Use the corresponding method inRange.Static methods pertaining toRangeinstances. Each of thenine types of rangescan 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,
Rangeinstances can be constructed by passing thebound typesexplicitly.- Bounded on both ends
range(C, com.google.common.collect.BoundType, C, com.google.common.collect.BoundType)- Unbounded on top (
(a..+∞)or(a..+∞)) downTo(C, com.google.common.collect.BoundType)- Unbounded on bottom (
(-∞..b)or(-∞..b]) upTo(C, com.google.common.collect.BoundType)
See the Guava User Guide article on
Range.- Since:
- 10.0
- Author:
- Kevin Bourrillion, Gregory Kick
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <C extends java.lang.Comparable<?>>
Range<C>all()Deprecated.Returns a range that contains every value of typeC.static <C extends java.lang.Comparable<?>>
Range<C>atLeast(C endpoint)Deprecated.Returns a range that contains all values greater than or equal toendpoint.static <C extends java.lang.Comparable<?>>
Range<C>atMost(C endpoint)Deprecated.Returns a range that contains all values less than or equal toendpoint.static <C extends java.lang.Comparable<?>>
Range<C>closed(C lower, C upper)Deprecated.Returns a range that contains all values greater than or equal tolowerand less than or equal toupper.static <C extends java.lang.Comparable<?>>
Range<C>closedOpen(C lower, C upper)Deprecated.Returns a range that contains all values greater than or equal tolowerand strictly less thanupper.static <C extends java.lang.Comparable<?>>
Range<C>downTo(C endpoint, BoundType boundType)Deprecated.Returns a range from the given endpoint, which may be either inclusive (closed) or exclusive (open), with no upper bound.static <C extends java.lang.Comparable<?>>
Range<C>encloseAll(java.lang.Iterable<C> values)Deprecated.Returns the minimal range that contains all of the given values.static <C extends java.lang.Comparable<?>>
Range<C>greaterThan(C endpoint)Deprecated.Returns a range that contains all values strictly greater thanendpoint.static <C extends java.lang.Comparable<?>>
Range<C>lessThan(C endpoint)Deprecated.Returns a range that contains all values strictly less thanendpoint.static <C extends java.lang.Comparable<?>>
Range<C>open(C lower, C upper)Deprecated.Returns a range that contains all values strictly greater thanlowerand strictly less thanupper.static <C extends java.lang.Comparable<?>>
Range<C>openClosed(C lower, C upper)Deprecated.Returns a range that contains all values strictly greater thanlowerand less than or equal toupper.static <C extends java.lang.Comparable<?>>
Range<C>range(C lower, BoundType lowerType, C upper, BoundType upperType)Deprecated.Returns a range that contains any value fromlowertoupper, where each endpoint may be either inclusive (closed) or exclusive (open).static <C extends java.lang.Comparable<?>>
Range<C>singleton(C value)Deprecated.Returns a range that contains only the given value.static <C extends java.lang.Comparable<?>>
Range<C>upTo(C endpoint, BoundType boundType)Deprecated.Returns a range with no lower bound up to the given endpoint, which may be either inclusive (closed) or exclusive (open).
-
-
-
Method Detail
-
open
public static <C extends java.lang.Comparable<?>> Range<C> open(C lower, C upper)
Deprecated.Returns a range that contains all values strictly greater thanlowerand strictly less thanupper.- Throws:
java.lang.IllegalArgumentException- ifloweris greater than or equal toupper
-
closed
public static <C extends java.lang.Comparable<?>> Range<C> closed(C lower, C upper)
Deprecated.Returns a range that contains all values greater than or equal tolowerand less than or equal toupper.- Throws:
java.lang.IllegalArgumentException- ifloweris greater thanupper
-
closedOpen
public static <C extends java.lang.Comparable<?>> Range<C> closedOpen(C lower, C upper)
Deprecated.Returns a range that contains all values greater than or equal tolowerand strictly less thanupper.- Throws:
java.lang.IllegalArgumentException- ifloweris greater thanupper
-
openClosed
public static <C extends java.lang.Comparable<?>> Range<C> openClosed(C lower, C upper)
Deprecated.Returns a range that contains all values strictly greater thanlowerand less than or equal toupper.- Throws:
java.lang.IllegalArgumentException- ifloweris greater thanupper
-
range
public static <C extends java.lang.Comparable<?>> Range<C> range(C lower, BoundType lowerType, C upper, BoundType upperType)
Deprecated.Returns a range that contains any value fromlowertoupper, where each endpoint may be either inclusive (closed) or exclusive (open).- Throws:
java.lang.IllegalArgumentException- ifloweris greater thanupper
-
lessThan
public static <C extends java.lang.Comparable<?>> Range<C> lessThan(C endpoint)
Deprecated.Returns a range that contains all values strictly less thanendpoint.
-
atMost
public static <C extends java.lang.Comparable<?>> Range<C> atMost(C endpoint)
Deprecated.Returns a range that contains all values less than or equal toendpoint.
-
upTo
public static <C extends java.lang.Comparable<?>> Range<C> upTo(C endpoint, BoundType boundType)
Deprecated.Returns a range with no lower bound up to the given endpoint, which may be either inclusive (closed) or exclusive (open).
-
greaterThan
public static <C extends java.lang.Comparable<?>> Range<C> greaterThan(C endpoint)
Deprecated.Returns a range that contains all values strictly greater thanendpoint.
-
atLeast
public static <C extends java.lang.Comparable<?>> Range<C> atLeast(C endpoint)
Deprecated.Returns a range that contains all values greater than or equal toendpoint.
-
downTo
public static <C extends java.lang.Comparable<?>> Range<C> downTo(C endpoint, BoundType boundType)
Deprecated.Returns a range from the given endpoint, which may be either inclusive (closed) or exclusive (open), with no upper bound.
-
all
public static <C extends java.lang.Comparable<?>> Range<C> all()
Deprecated.Returns a range that contains every value of typeC.
-
singleton
public static <C extends java.lang.Comparable<?>> Range<C> singleton(C value)
Deprecated.
-
encloseAll
public static <C extends java.lang.Comparable<?>> Range<C> encloseAll(java.lang.Iterable<C> values)
Deprecated.Returns the minimal range that contains all of the given values. The returned range is closed on both ends.- Throws:
java.lang.ClassCastException- if the parameters are not mutually comparablejava.util.NoSuchElementException- ifvaluesis emptyjava.lang.NullPointerException- if any ofvaluesis null
-
-