I have this piece of code
public <T> someMethod(Supplier<T> supplier) {
Objects.requireNonNull(supplier);
SupplierThrowsException<T, Throwable> supplierThrowsException = supplier::get;
return withThrowable(supplierThrowsException);
}
I am calling it like this
obj.someMethod(() -> myMethod(message))
I am 100% sure that the class of the object returned by myMethod()
does not implement Supplier interface. So where is the implementation of get()
.
I went through the Javadoc, I didn't get anything. I would like to understand what's going on here.
I found this and this but it doesn't clear my doubt. Let me know if I am missing anything here.