Class OptionalUtil


  • public final class OptionalUtil
    extends java.lang.Object
    Utilities for working with Optional values.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.Optional<T> zipWith​(java.util.Optional<T> a, java.util.Optional<T> b, java.util.function.BinaryOperator<T> f)
      If both a and b are present, return f(a, b).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • zipWith

        public static <T> java.util.Optional<T> zipWith​(java.util.Optional<T> a,
                                                        java.util.Optional<T> b,
                                                        java.util.function.BinaryOperator<T> f)
        If both a and b are present, return f(a, b).

        If only a is present, return a.

        Otherwise, return b.