Created
July 8, 2015 10:42
-
-
Save kkismd/aa20046aa52c8e81b267 to your computer and use it in GitHub Desktop.
パーシャルファンクション
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.Function2; | |
import scala.Predef.; | |
import scala.Serializable; | |
import scala.runtime.AbstractFunction2; | |
import scala.runtime.BoxesRunTime; | |
public final class Main$ | |
{ | |
public static final MODULE$; | |
static | |
{ | |
new (); | |
} | |
public void main(String[] args) | |
{ | |
Predef..MODULE$.println( | |
BoxesRunTime.boxToBoolean( | |
test(new AbstractFunction2() { | |
public static final long serialVersionUID = 0L; | |
public final boolean apply(String x$1, String x$2) { return x$1.endsWith(x$2); } | |
} | |
) | |
) | |
); | |
} | |
public boolean test(Function2<String, String, Object> f) { return BoxesRunTime.unboxToBoolean(f.apply("foo", "o")); } | |
private Main$() { MODULE$ = this; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main { | |
def main(args: Array[String]): Unit = { | |
println(test(_.endsWith(_))) | |
} | |
def test(f: (String,String) => Boolean): Boolean = f("foo", "o") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment