NullSafe

Null safe flow for Java and Android

Лицензия

Лицензия

Группа

Группа

ru.noties
Идентификатор

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

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

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

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

NullSafe
Null safe flow for Java and Android
Ссылка на сайт

Ссылка на сайт

https://github.com/noties/NullSafe
Система контроля версий

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

https://github.com/noties/NullSafe

Скачать nullsafe

Как подключить последнюю версию

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

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.android.support » support-annotations jar 26.0.2

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

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

NullSafe

Maven Central

Null safe flow for Java.

Java8:

// `country` can be null, meaning that no mapping will occur and "Unknown" will be returned
final String name = NullSafe.create(country)
        .map(Country::city) // map function will never call Supplier with null argument
        .map(City::street)
        .map(Street::name)
        .get("Unknown");
final City capitalCity = capitalCity();

final String name = NullSafe.create(country)
        .map(capitalCity, Country::city) // allows to specify def values (cannot be null)
        .map(City::street)
        .map(Street::name)
        .get("Unknown");
// NullSafe instance can be used to split the flow (safe to reference intermediate state)

final NullSafe<City> nullSafe = NullSafe.create(country)
        .map(capitalCity, Country::city);

final String name = nullSafe
        .map(City::street)
        .map(Street::name)
        .get(); // <- returns nullable if no def value was specified

final House house = nullSafe
        .map(City::street)
        .map(Street::house)
        .get();

This utility class is not thread-safe

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

Версия
1.0.0