Skip to content

Instantly share code, notes, and snippets.

@enebo

enebo/A.java Secret

Created June 23, 2021 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enebo/7e11bde5c0f981a843b36266c4060913 to your computer and use it in GitHub Desktop.
Save enebo/7e11bde5c0f981a843b36266c4060913 to your computer and use it in GitHub Desktop.
import java.util.function.Supplier;
public class A {
public static double squareLazy(Supplier<Double> lazyValue) {
return Math.pow(lazyValue.get(), 2);
}
}
system ~/work/jruby master 1109% CLASSPATH=. jruby -e 'p Java::A::square_lazy ->{ 2.0 }'
4.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment