Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Latest commit

 

History

History
45 lines (33 loc) · 1.46 KB

README.md

File metadata and controls

45 lines (33 loc) · 1.46 KB

Gallego

Optionals for Java 7

It depends...

Someone in Galicia

Build Status Bintray

This a lightweight copy of Guava's Optional interface.

For more awesome information, check out Guava wiki on Using/avoiding null.

Basic usage

Optional<Integer> possible = Optional.of(5);
possible.isPresent(); // returns true
possible.get(); // returns 5

More info in Guava's wiki

Why?

Java 8 Optionals are nice, but some of us can't enjoy them just yet*(Android)*.

Guava Optionals are great, but it's such a big dependency to have just for the Optional interface if you don't want to be messing around with Proguard and such.

This little library lets you use Optionals without adding more code than needed.

Download

The library is available in JCenter.

Gradle:

compile 'com.sloydev:gallego:1.0.0'

Maven:

<dependency>
  <groupId>com.sloydev</groupId>
  <artifactId>gallego</artifactId>
  <version>1.0.0</version>
</dependency>