This
- Self-reference to the subclass type itself.public abstract class SingleLong<This extends SingleLong<This>> extends Object implements SingleNumber<This>, LongSupplier
Single
.Modifier | Constructor and Description |
---|---|
protected |
SingleLong(long rawValue,
LongFunction<? extends This> constructor)
Equivalent to
SingleLong(rawValue, constructor, true) . |
protected |
SingleLong(long rawValue,
LongFunction<? extends This> constructor,
boolean applyRules) |
Modifier and Type | Method and Description |
---|---|
Long |
asNumber() |
int |
compareTo(This that) |
int |
compareToNumber(long number) |
int |
compareToNumber(Number number) |
This |
divideBy(long number) |
This |
divideBy(LongSupplier number) |
This |
divideBy(Number number) |
boolean |
equals(Object other) |
boolean |
equals(This that) |
Optional<This> |
filter(LongPredicate condition)
Test the raw value by
condition . |
This |
flatMap(LongFunction<? extends This> mapper)
Construct a new value of this type with the raw underlying value converted by
mapper . |
long |
getAsLong() |
int |
hashCode() |
boolean |
is(LongPredicate condition)
Test the raw value with
condition . |
boolean |
isGreaterThan(LongSupplier number) |
boolean |
isGreaterThanOrEqualTo(LongSupplier number) |
boolean |
isLessThan(LongSupplier number) |
boolean |
isLessThanOrEqualTo(LongSupplier number) |
boolean |
isNegative() |
boolean |
isNot(LongPredicate condition)
Reverse of
is(LongPredicate) . |
boolean |
isPositive() |
boolean |
isZero() |
This |
map(LongUnaryOperator mapper)
Construct a new value of this type with the raw underlying value converted by
mapper . |
This |
minus(long number) |
This |
minus(LongSupplier number) |
This |
minus(Number number) |
This |
multiplyBy(long number) |
This |
multiplyBy(LongSupplier number) |
This |
multiplyBy(Number number) |
This |
plus(long number) |
This |
plus(LongSupplier number) |
This |
plus(Number number) |
long |
raw() |
String |
toString()
Override this method to provide custom
Object.toString() formatting. |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
$, $, $, divideBy, divideBy, format, format, isGreaterThan, isGreaterThan, isGreaterThanOrEqualTo, isGreaterThanOrEqualTo, isLessThan, isLessThan, isLessThanOrEqualTo, isLessThanOrEqualTo, isNonZero, minus, minus, multiplyBy, multiplyBy, plus, plus
isGreaterThan, isGreaterThanOrEqualTo, isLessThan, isLessThanOrEqualTo, max, min
protected SingleLong(long rawValue, LongFunction<? extends This> constructor)
SingleLong(rawValue, constructor, true)
.protected SingleLong(long rawValue, LongFunction<? extends This> constructor, boolean applyRules)
rawValue
- The raw, immutable value this object will represent.constructor
- A method reference to the constructor of the implementing subclass.applyRules
- Whether to apply rules to the raw value.public final long raw()
public final long getAsLong()
getAsLong
in interface LongSupplier
public String toString()
Object.toString()
formatting.
The default passes the call through to Long.toString()
.public final boolean equals(This that)
public final Long asNumber()
asNumber
in interface SingleNumber<This extends SingleLong<This>>
public final int compareTo(This that)
compareTo
in interface Comparable<This extends SingleLong<This>>
public final int compareToNumber(Number number)
compareToNumber
in interface SingleNumber<This extends SingleLong<This>>
public final int compareToNumber(long number)
public final boolean isZero()
isZero
in interface SingleNumber<This extends SingleLong<This>>
public final boolean isPositive()
isPositive
in interface SingleNumber<This extends SingleLong<This>>
public final boolean isNegative()
isNegative
in interface SingleNumber<This extends SingleLong<This>>
public final This plus(Number number)
plus
in interface SingleNumber<This extends SingleLong<This>>
public final This minus(Number number)
minus
in interface SingleNumber<This extends SingleLong<This>>
public final This multiplyBy(Number number)
multiplyBy
in interface SingleNumber<This extends SingleLong<This>>
public final This divideBy(Number number)
divideBy
in interface SingleNumber<This extends SingleLong<This>>
public final This plus(long number)
public final This minus(long number)
public final This multiplyBy(long number)
public final This divideBy(long number)
public final This plus(LongSupplier number)
public final This minus(LongSupplier number)
public final This multiplyBy(LongSupplier number)
public final This divideBy(LongSupplier number)
public final boolean isGreaterThan(LongSupplier number)
public final boolean isGreaterThanOrEqualTo(LongSupplier number)
public final boolean isLessThan(LongSupplier number)
public final boolean isLessThanOrEqualTo(LongSupplier number)
public final boolean is(LongPredicate condition)
condition
.
This method is useful when using Optional.filter(java.util.function.Predicate<? super T>)
or Stream.filter(java.util.function.Predicate<? super T>)
.
optional.filter(x -> x.is($ -> $ > 0))
public final boolean isNot(LongPredicate condition)
is(LongPredicate)
.public final Optional<This> filter(LongPredicate condition)
condition
.Optional
containing this instance if the condition is met; empty otherwise.is(LongPredicate)
public final This map(LongUnaryOperator mapper)
mapper
.mapper
- The mapping function to apply to the raw underlying value.public final This flatMap(LongFunction<? extends This> mapper)
mapper
.mapper
- The mapping function to apply to the raw underlying value.mapper
.Copyright © 2022. All rights reserved.