Either

A tiny library that offers the Either type in Java.

License

License

GroupId

GroupId

de.scravy
ArtifactId

ArtifactId

either
Last Version

Last Version

1.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

Either
A tiny library that offers the Either type in Java.
Project URL

Project URL

https://github.com/scravy/java-either
Source Code Management

Source Code Management

https://github.com/scravy/java-either

Download either

How to add to project

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

Dependencies

compile (2)

Group / Artifact Type Version
de.scravy : pair jar 1.1.0
junit : junit jar 4.12

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.2

Project Modules

There are no modules declared in this project.

java-either

Do you know https://hackage.haskell.org/package/base-4.7.0.0/docs/Data-Either.html? So this is the crippled Java version of it.

It's on Maven Central

<dependency>
  <groupId>de.scravy</groupId>
  <artifactId>either</artifactId>
  <version>1.0.0</version>
</dependency>

It's easy

final Either<String, Exception> value = Either.left("Hello World!");
if (value.isLeft()) {
    System.out.println(value.getLeft());
}

-or-

final Either<String, Exception> value = Either.left("Hello World!");
if (value instanceof Either.Left) {
    System.out.println(value.getLeft());
}

It's free

MIT License.

Versions

Version
1.3.0
1.2.0
1.1.0
1.0.1
1.0.0