aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-10-19 15:43:27 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2018-10-19 15:43:27 +0200
commit133ecd0f22b31e5c4ab8998fca4407e2e034231e (patch)
treee5ae818b020de01ad1143079cc04c5e2d05eb2c4 /vespajlib
parent70ef529c2a86d9a2768dac1914de78f6a56ebbc6 (diff)
Use orElse
Diffstat (limited to 'vespajlib')
-rw-r--r--vespajlib/src/main/java/com/yahoo/lang/SettableOptional.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/lang/SettableOptional.java b/vespajlib/src/main/java/com/yahoo/lang/SettableOptional.java
index 47150876cab..cccdb5f302d 100644
--- a/vespajlib/src/main/java/com/yahoo/lang/SettableOptional.java
+++ b/vespajlib/src/main/java/com/yahoo/lang/SettableOptional.java
@@ -21,7 +21,7 @@ public final class SettableOptional<T> {
/** Creates a new settable optional with the given value, or an empty */
public SettableOptional(Optional<T> value) {
- this.value = value.isPresent() ? value.get() : null;
+ this.value = value.orElse(null);
}
public boolean isPresent() {
@@ -39,7 +39,7 @@ public final class SettableOptional<T> {
}
public void set(Optional<T> value) {
- this.value = value.isPresent() ? value.get() : null;
+ this.value = value.orElse(null);
}
public Optional<T> asOptional() {