I have a need for a \"Runnable that accepts a parameter\" although I know that such runnable doesn\'t really exist.
This may point to fundamental flaw in the design
Since Java 8, the best answer is to use Consumer
:
https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html
It's one of the functional interfaces, which means you can call it as a lambda expression:
void doSomething(Consumer something) {
something.accept("hello!");
}
...
doSomething( (something) -> System.out.println(something) )
...