Comparable<JsInt>
, JsElem
, JsNumber
public final class JsInt extends Object implements JsNumber, Comparable<JsInt>
Modifier and Type | Field | Description |
---|---|---|
int |
x |
The integer value.
|
Modifier and Type | Method | Description |
---|---|---|
int |
compareTo(JsInt o) |
Compares two
JsInt objects numerically. |
boolean |
equals(@Nullable Object that) |
Indicates whether some other object is "equal to" this json integer.
|
int |
hashCode() |
Returns the hashcode of this json integer.
|
JsInt |
map(IntUnaryOperator fn) |
Maps this json integer into another one.
|
JsInt |
minus(JsInt that) |
subtract this integer from the specified one
|
static JsInt |
of(int n) |
Static factory method to create a JsInt from an integer primitive type.
|
JsInt |
plus(JsInt that) |
adds up this integer to the specified one
|
boolean |
test(IntPredicate predicate) |
Tests the value of this json integer on a predicate.
|
JsInt |
times(JsInt that) |
multiplies this integer by the specified one
|
String |
toString() |
asJsArray, asJsBigDec, asJsBigInt, asJsBool, asJsDouble, asJsInt, asJsLong, asJsObj, asJson, asJsStr, isArray, isArray, isBigDec, isBigDec, isBigInt, isBigInt, isBool, isDouble, isDouble, isFalse, isInstant, isInstant, isInt, isInt, isIntegral, isJson, isJson, isLocalDate, isLocalDate, isLocalDateTime, isLocalDateTime, isLong, isLong, isNothing, isNotJson, isNotNothing, isNotNull, isNotNumber, isNull, isNumber, isObj, isObj, isStr, isStr, isTrue
public int compareTo(JsInt o)
JsInt
objects numerically.compareTo
in interface Comparable<JsInt>
Integer.compareTo(Integer)
public boolean equals(@Nullable Object that)
JsInt.of(1).equals(JsDouble.of(1.00))
JsInt.of(1).equals(JsLong.of(1))
JsInt.of(1).equals(JsBigInt.of(BigInteger.ONE))
JsInt.of(1).equals(JsBigDec.of(BigDecimal.valueOf(1.0)))
public int hashCode()
public String toString()
toString
in class Object
Integer.toString
public static JsInt of(int n)
n
- the integer primitive typepublic JsInt map(IntUnaryOperator fn)
fn
- the mapping functionpublic JsInt plus(JsInt that)
that
- the specified integerpublic JsInt minus(JsInt that)
that
- the specified integerpublic JsInt times(JsInt that)
that
- the specified integerpublic boolean test(IntPredicate predicate)
predicate
- the predicateCopyright © 2019. All rights reserved.