give a function as parameter
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/4685563/how-to-pass-a-function-as-a-parameter-in-java">How to pass a function as a parameter in Java?</a>  </p>
</blockquote>



<p>How can i give a function as parameter?</p>

<p>for example:</p>

<pre><code>for(Confetti c : confetti) {
   b.draw(someFunction(){strokeWeight(random(10));
}
</code></pre>

<p>where in the confetti class there would be something like</p>

<pre><code>draw(void myFunc){
   for(int i = 0; i &lt; 10; i++) {
    myFunc(); // run it
    ellipse(50, 50, 5, 5);
   }
}
</code></pre>
