title: Pass Object as a Parameter to ActionListener
body: <p>How can I pass an additional parameter?</p>
  
  <p>Here is some sample code to try and make it clear on what I want to do:</p>
  
  <pre><code>public class A {
  
      public static void create(String txt, ActionListener evt){
          MenuItem item = new MenuItem(txt);
          SomeClass sample_class = new SomeClass();
  
          // Would like to do this...
          // item.addActionListener(evt, sample_class);
  
          item.addActionListener(evt);
      }
  
  }
  
  public class B {
  
      public static void init(){
          A.create("Test", evt -&gt; {
              System.out.println("hi");
          });
      }
  
  }
  </code></pre>
  
  <p>What I would like to do, is pass the "sample_class" so the action listener can use it.</p>
  
  <p>So the end result would be like this, so I can use my class in the listener...</p>
  
  <pre><code>A.create("Test", (evt, something) -&gt; {
      something.do_something();
  });
  </code></pre>
  
  <p>Have read quite a few questions similar to this, but I can't wrap my ahead around it.</p>