try-parse

Provides functionality to parse to Optional and its primitive versions

License

License

GroupId

GroupId

com.github.robtimus
ArtifactId

ArtifactId

try-parse
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

try-parse
Provides functionality to parse to Optional and its primitive versions
Project URL

Project URL

https://robtimus.github.io/try-parse/
Source Code Management

Source Code Management

https://github.com/robtimus/try-parse

Download try-parse

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.robtimus/try-parse/ -->
<dependency>
    <groupId>com.github.robtimus</groupId>
    <artifactId>try-parse</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.robtimus/try-parse/
implementation 'com.github.robtimus:try-parse:1.1.1'
// https://jarcasting.com/artifacts/com.github.robtimus/try-parse/
implementation ("com.github.robtimus:try-parse:1.1.1")
'com.github.robtimus:try-parse:jar:1.1.1'
<dependency org="com.github.robtimus" name="try-parse" rev="1.1.1">
  <artifact name="try-parse" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.robtimus', module='try-parse', version='1.1.1')
)
libraryDependencies += "com.github.robtimus" % "try-parse" % "1.1.1"
[com.github.robtimus/try-parse "1.1.1"]

Dependencies

test (3)

Group / Artifact Type Version
org.junit.jupiter : junit-jupiter jar 5.7.0
org.hamcrest : hamcrest jar 2.2
org.mockito : mockito-core jar 3.5.13

Project Modules

There are no modules declared in this project.

try-parse

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.

Versions

Version
1.1.1
1.1
1.0