import java.util.*;
import java.lang.*;
import java.io.*;
class TestClass {
@FunctionalInterface
public interface ToDoubleFunction<T extends TestClass, U extends Number> {
Double applyAsDouble
(T classInstance, U value
); }
<U
extends Number
> Double getDouble
(U value
) {
return value.doubleValue();
}
{
ToDoubleFunction<TestClass, Long> tdf = TestClass::getDouble;
TestClass c = new TestClass();
System.
out.
println(tdf.
applyAsDouble(c,
new Long(43))); }
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBUZXN0Q2xhc3MgewoJCglARnVuY3Rpb25hbEludGVyZmFjZQoJcHVibGljIGludGVyZmFjZSBUb0RvdWJsZUZ1bmN0aW9uPFQgZXh0ZW5kcyBUZXN0Q2xhc3MsIFUgZXh0ZW5kcyBOdW1iZXI+IHsKCQlEb3VibGUgYXBwbHlBc0RvdWJsZShUIGNsYXNzSW5zdGFuY2UsIFUgdmFsdWUpOwoJfQoKCTxVIGV4dGVuZHMgTnVtYmVyPiBEb3VibGUgZ2V0RG91YmxlKFUgdmFsdWUpIHsKCQlTeXN0ZW0ub3V0LnByaW50bG4odGhpcyk7CgkJCiAgICAgICAgcmV0dXJuIHZhbHVlLmRvdWJsZVZhbHVlKCk7CiAgICB9CiAgICAKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVRvRG91YmxlRnVuY3Rpb248VGVzdENsYXNzLCBMb25nPiB0ZGYgPSBUZXN0Q2xhc3M6OmdldERvdWJsZTsKCQkKCQlUZXN0Q2xhc3MgYyA9IG5ldyBUZXN0Q2xhc3MoKTsKCQkKCQlTeXN0ZW0ub3V0LnByaW50bG4oYyk7CgkJCgkJU3lzdGVtLm91dC5wcmludGxuKHRkZi5hcHBseUFzRG91YmxlKGMsIG5ldyBMb25nKDQzKSkpOwoJfQp9