Callable<R>takes no arguments and returnsR.Runnabletakes no arguments and returnsvoid.Function<T, R>takes an argument,T, and returnsR.
What about a function that takes an argument and returns void? What is this analog called in Java?
It's Consumer<T>. It has one input and returns void with method Consumer::accept(T t).
Represents an operation that accepts a single input argument and returns no result.
There is its variation called BiConsumer<T, U> which turns 2 inputs into void.
What you are looking for is the Consumer. It is a functional interface that takes a single argument and returns void.
voidas a generic argument in Java.Consumer<T>java.lang.Voidcould be used for this.voidas a type param seems a bit hacky. I was looking forConsumer-- thanks.