You can use Runnable (void) or Callable (return value). But, as you have noticed, packages often create their own. Part of the reason is to have a more meaningful name than run or call . You should notice that Java has no C # style delegates, and it has no way to implicitly convert a method and an instance of an interface.
Please note that none of the above interfaces allow parameters. If you need, you will need a different solution.
EDIT: I have used Apache Functor in the past, and it has some of these interfaces (like UnaryProcedure and UnaryFunction for the ones in question). However, I would still consider creating my own, especially if you don't need anything else from the Functor (e.g. algorithm or adapter )
source share