This works
Supplier<Double> random1 = () -> Math.random();
Why this doesn't work:
Supplier<Double> random2 = () -> Math::random
Using just the method reference would work such as:
Supplier<Double> random2 = Math::random
since it already represents a Supplier<Double>.
On the other hand, the current notation that you've used would represent a Supplier of Supplier<Double> such as:
Supplier<Supplier<Double>> random2 = () -> Math::random;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With