supplier

(Java 8) java.util.function.Supplier

做~自己de王妃 提交于 2021-02-07 11:11:05
问题 In the following code, I tried to call the info method taking a Supplier. (The info method is overloaded: one is taking a String and the other is taking a Supplier.) The compiler complains that "The method info(String) is not applicable for the argument Supplier<Double> ". My expectation is to call the info method taking a Supplier by sending a Supplier object. Can I get some help to understand this error? Supplier<Double> randomSupplier = new Supplier<Double>() { public Double get() { return

(Java 8) java.util.function.Supplier

坚强是说给别人听的谎言 提交于 2021-02-07 11:06:57
问题 In the following code, I tried to call the info method taking a Supplier. (The info method is overloaded: one is taking a String and the other is taking a Supplier.) The compiler complains that "The method info(String) is not applicable for the argument Supplier<Double> ". My expectation is to call the info method taking a Supplier by sending a Supplier object. Can I get some help to understand this error? Supplier<Double> randomSupplier = new Supplier<Double>() { public Double get() { return

(Java 8) java.util.function.Supplier

不羁的心 提交于 2021-02-07 11:05:37
问题 In the following code, I tried to call the info method taking a Supplier. (The info method is overloaded: one is taking a String and the other is taking a Supplier.) The compiler complains that "The method info(String) is not applicable for the argument Supplier<Double> ". My expectation is to call the info method taking a Supplier by sending a Supplier object. Can I get some help to understand this error? Supplier<Double> randomSupplier = new Supplier<Double>() { public Double get() { return