title: How do I pass a scope as a parameter in Java?
body: <p>So... not entirely sure if this has been answered before, though I suspect it has and I simply didn't understand it with my current knowledge of the language. As such, a tad bit further of an explanation may be nice, the thread I believe that this may be a duplicate of is</p>
  
  <p><a href="https://stackoverflow.com/questions/2186931/java-pass-method-as-parameter">Java Pass Method as Parameter</a></p>
  
  <p>The basic idea of what I would like to do is something like this:</p>
  
  <pre><code>public void doStuff(String parameter, int parameter, Action/Method/Scope/thing action){
      for(parameters){
          action();
      }
  }
  </code></pre>
  
  <p>which would be called like this:</p>
  
  <pre><code>String parameter1;
  int parameter2;
  doStuff(parameter1, parameter2){
      action
  }
  </code></pre>
  
  <p>this is really generic. Sorry about not having anything specific now. The main thing I'm thinking of is that I've been trying to make an "artillery game" similar to Arcanists (target), or maybe gravitee wars (as a more recent/popular example) the annoying bit is I am frequently working with editing images at a pixel level because the generic bufferedImage/graphic/whatever the normal one &amp; GreenfootImage (greenfoot is the environment I'm using) lack what I want.</p>
  
  <p>really tired right now, please be patient with me. if some of this looks odd of incoherent feel free to ask for clarification, I'm not always the easiest to understand when I'm typing tiredly.</p>