Interface NumberDefinition

    • Method Detail

      • booleanValue

        static boolean booleanValue​(java.lang.Comparable<?> number)
      • byteValue

        static byte byteValue​(java.lang.Comparable<?> number)
      • doubleValue

        static double doubleValue​(java.lang.Comparable<?> number)
      • floatValue

        static float floatValue​(java.lang.Comparable<?> number)
      • intValue

        static int intValue​(java.lang.Comparable<?> number)
      • longValue

        static long longValue​(java.lang.Comparable<?> number)
      • parseDouble

        static double parseDouble​(java.lang.CharSequence sequence)
        Parses a CharSequence into a double. Only plain and simple numbers are supported – no scientific notation, no hexadecimal notation, no octal notation, no binary notation, no fractions, no exponents, no grouping, no leading or trailing whitespace, no commas, no underscores, no currency symbols, no NaN, no positive or negative infinity or anything else fancy – just plain and simple numbers.

        If the CharSequence is null a NullPointerException is thrown.

        If it's empty, length zero, zero is returned.

        If it contains any characters other than '+', '-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8' or '9' the return value is undefined.

        If any of the characters '+', '-' or '.' appears more than once the return value is undefined.

        If both '+' and '-' appear the return value is undefined.

        If there are more than 16 digits after the decimal point the return value is undefined.

        This method does not throw any exceptions (other than that eventual NullPointerException). Nor does it do any error checking.

        This method is more than 10 times faster than Double.parseDouble(String). It takes a CharSequence, rather than String, as input. Further more it does not create any garbage (no intermediate objects created).

      • parseFloat

        static float parseFloat​(java.lang.CharSequence sequence)
        Similar to parseDouble(CharSequence) but for float, and thus limited to 7 digits after the decimal point. It is almost 10 times faster than Float.parseFloat(String).
        See Also:
        parseDouble(CharSequence)
      • parseLong

        static long parseLong​(java.lang.CharSequence sequence)
        Similar to parseDouble(CharSequence) but for long. Performs roughly the same as Long.parseLong(String), but takes a CharSequence, rather than String, as input.
        See Also:
        parseDouble(CharSequence)
      • shortValue

        static short shortValue​(java.lang.Comparable<?> number)
      • toBoolean

        static boolean toBoolean​(int value)
      • toInt

        static int toInt​(double value)
      • toInt

        static int toInt​(float value)
      • toLong

        static long toLong​(double value)
      • booleanValue

        default boolean booleanValue()
      • byteValue

        default byte byteValue()
      • doubleValue

        double doubleValue()
      • floatValue

        default float floatValue()
      • intValue

        default int intValue()
      • longValue

        default long longValue()
      • shortValue

        default short shortValue()