A Java 8 compatibility Kit for Scala.
A set of Functional Interfaces
for scala.FunctionN
. These are designed for convenient construction of Scala functions
using Java 8 lambda syntax.
import scala.concurrent.*;
import static scala.compat.java8.JFunction.*;
class Test {
private static Future<Integer> futureExample(Future<String> future, ExecutionContext ec) {
return future.map(func(s -> s.toUpperCase()), ec).map(func(s -> s.length()), ec);
}
}
TODO
TODO
% (export JAVA_HOME=`java_home 1.8`; export PATH=$JAVA_HOME/bin:$PATH; sbt test)
- Augment the code generator to also generate specialized variants of the functional interface and modify scalac to emit lambdas as calls to the lambda MetaFactory against them.
@FunctionalInterface
public interface JFunction1$mcII$sp extends JFunction1 {
abstract int apply$mcII$sp(int v1);
default Object apply(Object s) { return (Integer) apply$mcII$sp((Integer) s); }
}