I\'m looking for the inverse of Supplier
in Guava. I hoped it would be called Consumer
– nope – or Sink
– exists, but is for pri
Your alternatives are:
In all of these languages, you can use functional interfaces conveniently, so you could also use e.g. Functional Java's Effect.
Otherwise, you better rely on existing language constructs for performing side effects, e.g. the built-in for
loop. Java < 8 inflicts tremendous syntactic overhead when using lambdas. See this question and this discussion.