This
- Self-reference to the subclass type itself.public abstract class SingleInt<This extends SingleInt<This>> extends Object implements SingleNumber<This>, IntSupplier
Single
.Modifier | Constructor and Description |
---|---|
protected |
SingleInt(int rawValue,
IntFunction<? extends This> constructor) |
Modifier and Type | Method and Description |
---|---|
Integer |
asNumber() |
int |
compareTo(This that) |
int |
compareToNumber(int number) |
int |
compareToNumber(Number number) |
This |
divideBy(int number) |
This |
divideBy(IntSupplier number) |
This |
divideBy(Number number) |
boolean |
equals(Object other) |
boolean |
equals(This that) |
Optional<This> |
filter(IntPredicate condition)
Test the raw value by
condition . |
This |
flatMap(IntFunction<? extends This> mapper)
Construct a new value of this type with the raw underlying value converted by
mapper . |
int |
getAsInt() |
int |
hashCode() |
boolean |
is(IntPredicate condition)
Test the raw value with
condition . |
boolean |
isGreaterThan(IntSupplier number) |
boolean |
isGreaterThanOrEqualTo(IntSupplier number) |
boolean |
isLessThan(IntSupplier number) |
boolean |
isLessThanOrEqualTo(IntSupplier number) |
boolean |
isNegative() |
boolean |
isNot(IntPredicate condition)
Reverse of
is(IntPredicate) . |
boolean |
isPositive() |
boolean |
isZero() |
This |
map(IntUnaryOperator mapper)
Construct a new value of this type with the raw underlying value converted by
mapper . |
This |
minus(int number) |
This |
minus(IntSupplier number) |
This |
minus(Number number) |
This |
multiplyBy(int number) |
This |
multiplyBy(IntSupplier number) |
This |
multiplyBy(Number number) |
This |
plus(int number) |
This |
plus(IntSupplier number) |
This |
plus(Number number) |
int |
raw()
Return the raw underlying value.
|
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 SingleInt(int rawValue, IntFunction<? extends This> constructor)
rawValue
- The raw, immutable value this object will represent.constructor
- A method reference to the constructor of the implementing subclass.public final int raw()
public final int getAsInt()
getAsInt
in interface IntSupplier
public String toString()
Object.toString()
formatting.
The default passes the call through to Double.toString()
.public final boolean equals(This that)
public final Integer asNumber()
asNumber
in interface SingleNumber<This extends SingleInt<This>>
public final int compareTo(This that)
compareTo
in interface Comparable<This extends SingleInt<This>>
public final int compareToNumber(Number number)
compareToNumber
in interface SingleNumber<This extends SingleInt<This>>
public final int compareToNumber(int number)
public final boolean isZero()
isZero
in interface SingleNumber<This extends SingleInt<This>>
public final boolean isPositive()
isPositive
in interface SingleNumber<This extends SingleInt<This>>
public final boolean isNegative()
isNegative
in interface SingleNumber<This extends SingleInt<This>>
public final This plus(Number number)
plus
in interface SingleNumber<This extends SingleInt<This>>
public final This minus(Number number)
minus
in interface SingleNumber<This extends SingleInt<This>>
public final This multiplyBy(Number number)
multiplyBy
in interface SingleNumber<This extends SingleInt<This>>
public final This divideBy(Number number)
divideBy
in interface SingleNumber<This extends SingleInt<This>>
public final This plus(int number)
public final This minus(int number)
public final This multiplyBy(int number)
public final This divideBy(int number)
public final This plus(IntSupplier number)
public final This minus(IntSupplier number)
public final This multiplyBy(IntSupplier number)
public final This divideBy(IntSupplier number)
public final boolean isGreaterThan(IntSupplier number)
public final boolean isGreaterThanOrEqualTo(IntSupplier number)
public final boolean isLessThan(IntSupplier number)
public final boolean isLessThanOrEqualTo(IntSupplier number)
public final boolean is(IntPredicate 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(IntPredicate condition)
is(IntPredicate)
.public final Optional<This> filter(IntPredicate condition)
condition
.Optional
containing this instance if the condition is met; empty otherwise.is(IntPredicate)
public final This map(IntUnaryOperator mapper)
mapper
.mapper
- The mapping function to apply to the raw underlying value.public final This flatMap(IntFunction<? extends This> mapper)
mapper
.mapper
- The mapping function to apply to the raw underlying value.mapper
.Copyright © 2022. All rights reserved.