Skip to content

Provides functionality to parse to Optional and its primitive versions

License

Notifications You must be signed in to change notification settings

robtimus/try-parse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.