This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git


The following commit(s) were added to refs/heads/master by this push:
     new a64ab7b  add an extra maybe method
a64ab7b is described below

commit a64ab7bcaf2b4bf7f7ecc552967e2ef05012178e
Author: Alex Heneveld <[email protected]>
AuthorDate: Fri Nov 13 14:10:00 2020 +0000

    add an extra maybe method
---
 utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java 
b/utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java
index afaf53f..cc58e0e 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java
@@ -330,6 +330,11 @@ public abstract class Maybe<T> implements Serializable, 
Supplier<T> {
         return nextValue.get();
     }
 
+    public Maybe<T> orMaybe(Supplier<Maybe<T>> nextValue) {
+        if (isPresent()) return this;
+        return nextValue.get();
+    }
+
     public T orNull() {
         if (isPresent()) return get();
         return null;

Reply via email to