C - the type of this range@Immutable @ParametersAreNonnullByDefault @FunctionalInterface public interface Range<C extends Comparable<C>>
Comparable type.| Modifier and Type | Method and Description |
|---|---|
static <C extends Comparable<C>> |
all()
Creates a range that contains every value of type
C. |
static <C extends Comparable<C>> |
and(Range<C> r1,
Range<C> r2)
Creates a range that contains all values enclosed by both ranges.
|
static <C extends Comparable<C>> |
atLeast(C lower)
Creates a range that contains all values greater than or equal to
lower. |
static <C extends Comparable<C>> |
atMost(C upper)
Creates a range that contains all values less than or equal to
upper. |
static <C extends Comparable<C>> |
closed(C lower,
C upper)
Creates a range that contains all values greater than or equal to
lower and less than or equal to upper. |
static <C extends Comparable<C>> |
closedOpen(C lower,
C upper)
Creates a range that contains all values greater than or equal to
lower and strictly less than upper. |
boolean |
contains(C value)
Returns
true if value is within the bounds of this range. |
default boolean |
containsAll(Iterable<? extends C> values)
Returns
true if every element in values is contained in this range. |
static <C extends Comparable<C>> |
empty()
Creates a range that does not contain any value.
|
static <C extends Comparable<C>> |
greaterThan(C lower)
Creates a range that contains all values strictly greater than
lower. |
static <C extends Comparable<C>> |
lessThan(C upper)
Creates a range that contains all values strictly less than
upper. |
static <C extends Comparable<C>> |
open(C lower,
C upper)
Creates a range that contains all values strictly greater than
lower and strictly less than upper. |
static <C extends Comparable<C>> |
openClosed(C lower,
C upper)
Creates a range that contains all values strictly greater than
lower and less than or equal to upper. |
static <C extends Comparable<C>> |
or(Range<C> r1,
Range<C> r2)
Creates a range that contains all values enclosed by at least one range.
|
static <C extends Comparable<C>> |
singleton(C value)
Creates a range that contains only the given
value. |
static <C extends Comparable<C>> |
xor(Range<C> r1,
Range<C> r2)
Creates a range that contains all values enclosed by one range, but not another.
|
@Nonnull static <C extends Comparable<C>> Range<C> open(C lower, C upper)
lower and strictly less than upper.C - the type of the rangelower - the lower bound of the range (exclusive)upper - the upper bound of the range (exclusive)NullPointerException - if any argument is nullIllegalArgumentException - if lower is greater than upper@Nonnull static <C extends Comparable<C>> Range<C> closed(C lower, C upper)
lower and less than or equal to upper.C - the type of the rangelower - the lower bound of the range (inclusive)upper - the upper bound of the range (inclusive)NullPointerException - if any argument is nullIllegalArgumentException - if lower is greater than upper@Nonnull static <C extends Comparable<C>> Range<C> openClosed(C lower, C upper)
lower and less than or equal to upper.C - the type of the rangelower - the lower bound of the range (exclusive)upper - the upper bound of the range (inclusive)NullPointerException - if any argument is nullIllegalArgumentException - if lower is greater than upper@Nonnull static <C extends Comparable<C>> Range<C> closedOpen(C lower, C upper)
lower and strictly less than upper.C - the type of the rangelower - the lower bound of the range (inclusive)upper - the upper bound of the range (exclusive)NullPointerException - if any argument is nullIllegalArgumentException - if lower is greater than upper@Nonnull static <C extends Comparable<C>> Range<C> singleton(C value)
value. The returned range is closed on both ends.C - the type of the rangevalue - the unique value of the rangeNullPointerException - if any argument is nullclosed(Comparable, Comparable)@Nonnull static <C extends Comparable<C>> Range<C> atLeast(C lower)
lower.C - the type of the rangelower - the lower bound of the range (inclusive)NullPointerException - if any argument is null@Nonnull static <C extends Comparable<C>> Range<C> atMost(C upper)
upper.C - the type of the rangeupper - the upper bound of the range (inclusive)NullPointerException - if any argument is null@Nonnull static <C extends Comparable<C>> Range<C> greaterThan(C lower)
lower.C - the type of the rangelower - the lower bound of the range (exclusive)NullPointerException - if any argument is null@Nonnull static <C extends Comparable<C>> Range<C> lessThan(C upper)
upper.C - the type of the rangeupper - the upper bound of the range (exclusive)NullPointerException - if any argument is null@Nonnull static <C extends Comparable<C>> Range<C> all()
C.C - the type of the range@Nonnull static <C extends Comparable<C>> Range<C> empty()
C - the type of the range@Nonnull static <C extends Comparable<C>> Range<C> and(Range<C> r1, Range<C> r2)
The intersection exists if and only if the two ranges are connected.
C - the type of the ranger1 - the first ranger2 - the second rangeNullPointerException - if any argument is nullBoolean.logicalAnd(boolean, boolean)@Nonnull static <C extends Comparable<C>> Range<C> or(Range<C> r1, Range<C> r2)
C - the type of the ranger1 - the first ranger2 - the second rangeNullPointerException - if any argument is nullBoolean.logicalOr(boolean, boolean)@Nonnull static <C extends Comparable<C>> Range<C> xor(Range<C> r1, Range<C> r2)
C - the type of the ranger1 - the first ranger2 - the second rangeNullPointerException - if any argument is nullBoolean.logicalXor(boolean, boolean)boolean contains(C value)
true if value is within the bounds of this range.value - the value to be tested for inclusiontrue if value is within the bounds of this rangeNullPointerException - if any argument is nulldefault boolean containsAll(Iterable<? extends C> values)
true if every element in values is contained in this range.values - the value to be tested for inclusiontrue if every element in values is contained in this rangeNullPointerException - if any argument is nullcontains(Comparable)Copyright © 2017–2019 Atlanmod. All rights reserved.