Class LambdaSafe.Callbacks<C,​A>

  • Type Parameters:
    C - the callback type
    A - the primary argument type
    Enclosing class:
    LambdaSafe

    public static final class LambdaSafe.Callbacks<C,​A>
    extends java.lang.Object
    Represents a collection of callbacks that can be invoked in a lambda safe way.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void invoke​(java.util.function.Consumer<C> invoker)
      Invoke the callback instances where the callback method returns void.
      <R> java.util.stream.Stream<R> invokeAnd​(java.util.function.Function<C,​R> invoker)
      Invoke the callback instances where the callback method returns a result.
      • Methods inherited from class java.lang.Object

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

      • invoke

        public void invoke​(java.util.function.Consumer<C> invoker)
        Invoke the callback instances where the callback method returns void.
        Parameters:
        invoker - the invoker used to invoke the callback
      • invokeAnd

        public <R> java.util.stream.Stream<R> invokeAnd​(java.util.function.Function<C,​R> invoker)
        Invoke the callback instances where the callback method returns a result.
        Type Parameters:
        R - the result type
        Parameters:
        invoker - the invoker used to invoke the callback
        Returns:
        the results of the invocation (may be an empty stream if no callbacks could be called)