scala> object Test { | def myMethod( f:(String,String)=>String) { | println("MyMethod result =" + f("a", "b")) | } | } defined module Test
scala> Test.myMethod( _ + "&" + _ ) MyMethod result =a&b
scala> Test.myMethod( (a,b)=> a+"&"+b ) MyMethod result =a&b
scala> Test.myMethod { (a,b)=>a+"&"+b } MyMethod result =a&b
scala> object Test { | def myMethod( f:(String,String)=>String) { | println("MyMethod result =" + f("a", "b")) | } | } defined module Test
scala> Test.myMethod( _ + "&" + _ ) MyMethod result =a&b
scala> Test.myMethod( (a,b)=> a+"&"+b ) MyMethod result =a&b
scala> Test.myMethod { (a,b)=>a+"&"+b } MyMethod result =a&b