@PublicApi public final class NumericFunctions extends Object
| Constructor and Description |
|---|
NumericFunctions() |
| Modifier and Type | Method and Description |
|---|---|
static Double |
doubleOrNull(Number number) |
static <T> Double |
doubleOrNull(T argument,
Function<? super T,? extends Number> function) |
static double |
doubleOrZero(Number number) |
static <T> double |
doubleOrZero(T argument,
Function<? super T,? extends Number> function) |
static boolean |
equals(Number a,
Number b) |
static long |
longAddOrNull(long a,
Long b) |
static Long |
longAddOrNull(Number a,
Number b)
Appends two numbers as long's with tracking of nulls
Axioms: null + a == a, a + null == a, a + b == a + b, null + null == null
|
static Long |
longOrNull(Number number) |
static <T> Long |
longOrNull(T argument,
Function<? super T,? extends Number> function) |
static long |
longOrZero(Number number) |
static <T> long |
longOrZero(T argument,
Function<? super T,? extends Number> function) |
static double |
nonNegativeDouble(Number number) |
static <T> double |
nonNegativeDouble(T argument,
Function<? super T,? extends Number> function) |
static Double |
nonNegativeDoubleAddOrNull(Number a,
Number b)
Appends two numbers as double's with tracking of nulls and clipping to zero.
|
static long |
nonNegativeLong(Number number) |
static <T> long |
nonNegativeLong(T argument,
Function<? super T,? extends Number> function) |
public static long longOrZero(Number number)
number - a numberlong value, 0L if nullpublic static <T> long longOrZero(T argument,
Function<? super T,? extends Number> function)
argument - an argumentfunction - a numeric functionlong value for the argument, 0L if anything is null@Nullable public static Long longOrNull(Number number)
number - a numberLong with the given number's long value, null if number is null@Nullable public static <T> Long longOrNull(T argument, Function<? super T,? extends Number> function)
argument - an argumentfunction - a numeric functionLong with the given function's long value for the argument, null if anything is nullpublic static long nonNegativeLong(Number number)
number - a numberlong value, 0L if null or negativepublic static <T> long nonNegativeLong(T argument,
Function<? super T,? extends Number> function)
argument - an argumentfunction - a numeric functionlong value for the argument, 0L if anything is null or negativepublic static double doubleOrZero(Number number)
number - a numberdouble value, 0.0 if nullpublic static <T> double doubleOrZero(T argument,
Function<? super T,? extends Number> function)
argument - an argumentfunction - a numeric functiondouble value for the argument, 0.0 if anything is null@Nullable public static Double doubleOrNull(Number number)
number - a numberDouble with the given number's double value, null if number is null@Nullable public static <T> Double doubleOrNull(T argument, Function<? super T,? extends Number> function)
argument - an argumentfunction - a numeric functionDouble with the given function's double value for the argument, null if anything is nullpublic static double nonNegativeDouble(Number number)
number - a numberdouble value, 0.0 if null or negativepublic static <T> double nonNegativeDouble(T argument,
Function<? super T,? extends Number> function)
argument - an argumentfunction - a numeric functiondouble value for the argument, 0.0 if anything is null or negativepublic static Double nonNegativeDoubleAddOrNull(Number a, Number b)
a - first operandb - second operandpublic static Long longAddOrNull(Number a, Number b)
a - first operandb - second operandpublic static long longAddOrNull(long a,
Long b)
Copyright © 2022 ALM Works. All Rights Reserved.