com.codepoetics:ambivalence

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

Группа

Группа

com.codepoetics
Идентификатор

Идентификатор

ambivalence
Последняя версия

Последняя версия

0.2
Дата

Дата

Тип

Тип

bundle
Описание

Описание

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Система контроля версий

Система контроля версий

http://github.com/poetix/ambivalence

Скачать ambivalence

Зависимости

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
org.hamcrest : hamcrest-library jar 1.3

Модули Проекта

Данный проект не имеет модулей.

ambivalence

Build Status

<dependency>
    <groupId>com.codepoetics</groupId>
    <artifactId>ambivalence</artifactId>
    <version>0.2</version>
</dependency>

An Either type for Java 8, in case you needed one.

Features:

  • join and forEither to access values safely.
  • left and right projections, with map and flatMap.
  • equals, hashCode and toString implemented.
  • Tryable wraps an exception-throwing lambda so that it returns Either<T, Exception>.
  • Eithers provides Stream collectors which split a stream of Either values and optionally collect the left values.
Either<String, Integer> stringOrInt1 = Either.ofLeft("a string");
Either<String, Integer> stringOrInt2 = Either.ofRight(23);

System.out.println(stringOrInt1.join(String::toUpperCase, Object::toString)); // prints "A STRING"
System.out.println(stringOrInt2.join(String::toUpperCase, Object::toString)); // prints "23"

Версии библиотеки

Версия
0.2