Package com.google.common.collect
Class GeneralRange<T>
java.lang.Object
com.google.common.collect.GeneralRange<T>
- All Implemented Interfaces:
Serializable
A generalized interval on any ordering, for internal use. Supports
null
. Unlike Range
, this allows the use of an arbitrary comparator. This is designed for use in the
implementation of subcollections of sorted collection types.
Whenever possible, use Range
instead, which is better supported.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Comparator
<? super T> private final boolean
private final boolean
private final BoundType
private final T
private GeneralRange
<T> private final BoundType
private final T
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
GeneralRange
(Comparator<? super T> comparator, boolean hasLowerBound, T lowerEndpoint, BoundType lowerBoundType, boolean hasUpperBound, T upperEndpoint, BoundType upperBoundType) -
Method Summary
Modifier and TypeMethodDescription(package private) static <T> GeneralRange
<T> all
(Comparator<? super T> comparator) Returns the whole range relative to the specified comparator.(package private) Comparator
<? super T> (package private) boolean
(package private) static <T> GeneralRange
<T> downTo
(Comparator<? super T> comparator, T endpoint, BoundType boundType) Returns everything above the endpoint relative to the specified comparator, with the specified endpoint behavior.boolean
(package private) static <T extends Comparable>
GeneralRange<T> Converts a Range to a GeneralRange.(package private) BoundType
(package private) T
(package private) BoundType
(package private) T
int
hashCode()
(package private) boolean
(package private) boolean
(package private) GeneralRange
<T> intersect
(GeneralRange<T> other) Returns the intersection of the two ranges, or an empty range if their intersection is empty.(package private) boolean
isEmpty()
(package private) static <T> GeneralRange
<T> range
(Comparator<? super T> comparator, T lower, BoundType lowerType, T upper, BoundType upperType) Returns everything between the endpoints relative to the specified comparator, with the specified endpoint behavior.(package private) GeneralRange
<T> reverse()
Returns the same range relative to the reversed comparator.(package private) boolean
(package private) boolean
toString()
(package private) static <T> GeneralRange
<T> upTo
(Comparator<? super T> comparator, T endpoint, BoundType boundType) Returns everything below the endpoint relative to the specified comparator, with the specified endpoint behavior.
-
Field Details
-
comparator
-
hasLowerBound
private final boolean hasLowerBound -
lowerEndpoint
-
lowerBoundType
-
hasUpperBound
private final boolean hasUpperBound -
upperEndpoint
-
upperBoundType
-
reverse
-
-
Constructor Details
-
GeneralRange
-
-
Method Details
-
from
Converts a Range to a GeneralRange. -
all
Returns the whole range relative to the specified comparator. -
downTo
static <T> GeneralRange<T> downTo(Comparator<? super T> comparator, T endpoint, BoundType boundType) Returns everything above the endpoint relative to the specified comparator, with the specified endpoint behavior. -
upTo
Returns everything below the endpoint relative to the specified comparator, with the specified endpoint behavior. -
range
static <T> GeneralRange<T> range(Comparator<? super T> comparator, T lower, BoundType lowerType, T upper, BoundType upperType) Returns everything between the endpoints relative to the specified comparator, with the specified endpoint behavior. -
comparator
Comparator<? super T> comparator() -
hasLowerBound
boolean hasLowerBound() -
hasUpperBound
boolean hasUpperBound() -
isEmpty
boolean isEmpty() -
tooLow
-
tooHigh
-
contains
-
intersect
Returns the intersection of the two ranges, or an empty range if their intersection is empty. -
equals
-
hashCode
public int hashCode() -
reverse
GeneralRange<T> reverse()Returns the same range relative to the reversed comparator. -
toString
-
getLowerEndpoint
-
getLowerBoundType
BoundType getLowerBoundType() -
getUpperEndpoint
-
getUpperBoundType
BoundType getUpperBoundType()
-