From 3e619a735e63a1222e71060d9e65b354a156b158 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 28 Jan 2015 23:45:38 +0100 Subject: o Major refactoring on the BtPromise, mainly internal. Renaming BtPromise to BtSequence and BtSequencer. --- app/src/main/java/io/trygvis/android/Optional.java | 45 ---------------------- 1 file changed, 45 deletions(-) delete mode 100644 app/src/main/java/io/trygvis/android/Optional.java (limited to 'app/src/main/java/io/trygvis/android/Optional.java') diff --git a/app/src/main/java/io/trygvis/android/Optional.java b/app/src/main/java/io/trygvis/android/Optional.java deleted file mode 100644 index 616f9a7..0000000 --- a/app/src/main/java/io/trygvis/android/Optional.java +++ /dev/null @@ -1,45 +0,0 @@ -package io.trygvis.android; - -public final class Optional { - private final T value; - - public Optional(T value) { - this.value = value; - } - - public T get() { - if (value == null) { - throw new IllegalStateException("get() on empty"); - } - - return value; - } - - public boolean isPresent() { - return value != null; - } - - public void ifPresent(Consumer consumer) { - if (value == null) { - return; - } - - consumer.accept(value); - } - - public static Optional of(T t) { - if (t == null) { - throw new IllegalArgumentException("t can't be null"); - } - - return new Optional<>(t); - } - - public static Optional empty() { - return new Optional<>(null); - } - - public static Optional ofNullable(T t) { - return t != null ? of(t) : empty(); - } -} -- cgit v1.2.3