Interface Callback

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Callback
A generic functional interface that is more semantically sound than Runnable. Use anywhere you wish to have a generic callback function.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    The method that will be called.
    static Callback
    Creates a dummy callback function.
    static Callback
    Returns the given callback object if it is not null.
  • Method Details

    • dummy

      static Callback dummy()
      Creates a dummy callback function. This is useful to avoid using null.
      Returns:
      a dummy callback function
    • dummyIfNull

      static Callback dummyIfNull(Callback c)
      Returns the given callback object if it is not null. Otherwise, a dummy() callback is returned. This is useful to avoid using null.
      Parameters:
      c - the callback function to check for null
      Returns:
      a non-null callback function
    • call

      void call()
      The method that will be called.