Interface InclusiveRange<T extends Comparable<T>>
- Type Parameters:
T- the type of the range values
- All Superinterfaces:
Wrapper
Represents a range of values with both ends inclusive.
- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleancontains(InclusiveRange<T> subRange) Checks if a range is within this range.default booleanisValueInRange(T value) Checks if a value is within the range.default <S extends Comparable<S>>
InclusiveRange<S> Maps the range to a new type.The maximum value in the range.The minimum value in the range.static <T extends Comparable<T>>
InclusiveRange<T> of(T value) Creates a new instance with the same min and max values.static <T extends Comparable<T>>
InclusiveRange<T> of(T minInclusive, T maxInclusive) Creates a new instance.Methods inherited from interface Wrapper
asHandle, toMinecraft, unwrap
-
Method Details
-
minInclusive
-
maxInclusive
-
map
@AsOf("3.0.0") default <S extends Comparable<S>> InclusiveRange<S> map(Function<? super T, ? extends S> mapper) Maps the range to a new type.- Type Parameters:
S- the type of the mapped values- Parameters:
mapper- the function to map the range values- Returns:
- a new range with the mapped values
- Since:
- 3.0.0
-
isValueInRange
-
contains
Checks if a range is within this range.- Parameters:
subRange- the range to check- Returns:
- true if the range is within this range, false otherwise
- Since:
- 3.0.0
-
of
@AsOf("3.0.0") static <T extends Comparable<T>> InclusiveRange<T> of(T minInclusive, T maxInclusive) Creates a new instance.- Type Parameters:
T- the type of the range values- Parameters:
minInclusive- the minimum value in the rangemaxInclusive- the maximum value in the range- Returns:
- a new instance
- Since:
- 3.0.0
-
of
Creates a new instance with the same min and max values.- Type Parameters:
T- the type of the range values- Parameters:
value- the value to use for both min and max- Returns:
- a new instance
- Since:
- 3.0.0
-