Skip to content

Latest commit

 

History

History
18 lines (14 loc) · 2.13 KB

README.md

File metadata and controls

18 lines (14 loc) · 2.13 KB

try-parse

Maven Central Build Status Quality Gate Status Coverage Known Vulnerabilities

Provides functionality to parse to Optional and its primitive versions.

Currently there are five sets of methods:

  • TryParse.tryParseInt: a copy of Integer.parseInt to parse to OptionalInt instead of throwing exceptions.
  • TryParse.tryParseUnsignedInt: a copy of Integer.parseUnsignedInt to parse to OptionalInt instead of throwing exceptions.
  • TryParse.tryParseLong: a copy of Long.parseLong to parse to OptionalLong instead of throwing exceptions.
  • TryParse.tryParseUnsignedLong: a copy of Long.parseUnsignedLong to parse to OptionalLong instead of throwing exceptions.
  • TryParse.tryParseBoolean: a copy of Boolean.parseBoolean to parse to Optional instead of returning false.

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.