title: Scala - Pass in a void function as a parameter
body: <p>I have a class with a constructor as defined below:</p>
  
  <pre><code>class Worker(val action: String, val owner: Component,
           validate: (RequestScopeObject) =&gt; Boolean,
           model: (RequestScopeObject) =&gt; Unit,
           connector: (RequestScopeObject) =&gt; Unit)
  </code></pre>
  
  <p>and another java class called FrameFactory with a method as below:</p>
  
  <pre><code>public static &lt;T extends Component&gt; T 
     createContainerAndShow(String framesetid, Component component)
  </code></pre>
  
  <p>When I am creating an instance of the Worker class as below:</p>
  
  <pre><code>new Worker(
      action = "actionName",
      owner = null,
      validate = (scopeObject) =&gt; {true},
      model = (scopeObject) =&gt; {},
      connector = (scopeObject: RequestScopeObject) =&gt; {
        FrameFactory.createContainerAndShow("string", new JPanel())
        () // forced to put a '()'  here as FrameFactory.createContainerAndShow 
           //returns the Jpanel created
      }
    ))
  </code></pre>
  
  <p>I was wondering if there was any way of writing this better? How do i declare the connector parameter as a function that returns Unit and ignore the JPanel returned by FrameFactory</p>