Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your alternatives are:</p> <ul> <li><strong>Java 8</strong> introduces a <a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html" rel="nofollow noreferrer"><code>Consumer</code></a> interface which you can <a href="https://docs.oracle.com/javase/8/docs/api/java/util/function/Consumer.html#andThen-java.util.function.Consumer-" rel="nofollow noreferrer">compose</a>.</li> <li><strong><a href="http://www.eclipse.org/xtend" rel="nofollow noreferrer">Xtend</a></strong>'s standard library contains <a href="http://download.eclipse.org/modeling/tmf/xtext/javadoc/2.3/org/eclipse/xtext/xbase/lib/Procedures.html" rel="nofollow noreferrer"><code>Procedures</code></a>.</li> <li><strong><a href="http://scala-lang.org/" rel="nofollow noreferrer">Scala</a></strong> has <a href="http://www.scala-lang.org/api/current/index.html#scala.Function1" rel="nofollow noreferrer"><code>Function*</code></a>; if a function's return type is <a href="http://www.scala-lang.org/api/current/index.html#scala.Unit" rel="nofollow noreferrer"><code>Unit</code></a>, it is considered a side effect.</li> </ul> <p>In all of these languages, you can use functional interfaces conveniently, so you could also use e.g. <a href="http://functionaljava.org/" rel="nofollow noreferrer">Functional Java</a>'s <a href="http://functionaljava.googlecode.com/svn/artifacts/3.0/javadoc/fj/Effect.html" rel="nofollow noreferrer"><code>Effect</code></a>.</p> <p><strong>Otherwise</strong>, you better rely on existing language constructs for performing side effects, e.g. the built-in <code>for</code> loop. Java &lt; 8 inflicts tremendous syntactic overhead when using lambdas. See <a href="https://stackoverflow.com/questions/9525951/anything-in-guava-similar-to-functional-javas-effect">this question</a> and <a href="http://code.google.com/p/guava-libraries/wiki/FunctionalExplained" rel="nofollow noreferrer">this discussion</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload