title: Smooth way of using Function<A, R> java interface from scala?
body: <p>Here at work most people use Java, while I am working with Scala. We have decided to gather some common classes in an library which will be written in Java. Now I want to add some pseudo-functional programming to the library, take a look at the following:</p>
  
  <p>java:</p>
  
  <pre><code>public interface Func&lt;A, R&gt; {
      public R f(a A);
  }
  
  public AClass {
      public &lt;R&gt; ArrayList&lt;R&gt; myMethod(
                               Func&lt;String, R&gt; func
      ) {
          // ...
      }
  }
  </code></pre>
  
  <p>usage in java:</p>
  
  <pre><code>AClass ac = new AClass();
  ArrayList&lt;String&gt; al = ac.myMethod(
                              new Func&lt;String, String&gt; (
                                  public String f(String s) {
                                      return s + "!";
                                  }
                              })
  </code></pre>
  
  <p>The above is not exactly exiting (more like daunting actually, from a scala perspective). Is there any way to summon some scala magic to be able to do something like the following in scala:</p>
  
  <pre><code>var ac = new ACLass
  var al = ac.myMethod(str =&gt; str + "!")             // alternative 1
  al = ac.myMethod { case: str:String =&gt; str + "!" } // alternative 2
  </code></pre>
  
  <p>I messed around with implicits for a while but couldn't get things sorted out =P. </p>