try-parse
Provides functionality to parse to Optional and its primitive versions.
Currently there are five sets of methods:
TryParse.tryParseInt
: a copy ofInteger.parseInt
to parse to OptionalInt instead of throwing exceptions.TryParse.tryParseUnsignedInt
: a copy ofInteger.parseUnsignedInt
to parse to OptionalInt instead of throwing exceptions.TryParse.tryParseLong
: a copy ofLong.parseLong
to parse to OptionalLong instead of throwing exceptions.TryParse.tryParseUnsignedLong
: a copy ofLong.parseUnsignedLong
to parse to OptionalLong instead of throwing exceptions.TryParse.tryParseBoolean
: a copy ofBoolean.parseBoolean
to parse to Optional instead of returningfalse
.
In addition, there are several methods that delegate to an existing method, catching expected exceptions. These are not as fast as the above five sets, but can still be useful.