Class NumberUtil


  • public final class NumberUtil
    extends Object
    Number-related utility methods.
    Since:
    6.7.0
    • Method Detail

      • parseInteger

        public static @NonNull Optional<Integer> parseInteger​(@Nullable String string)
        Parses the given string into an Integer. Returns an Optional rather than an OptionalInt, because they are easier to compose with other Optionals.
        Parameters:
        string - the string to parse
        Returns:
        an empty if the string is non-numeric, e.g. blank or alphanumeric
        See Also:
        NumberFormatException