Hi Alan,
On 30/04/2020 11:48, Alan Bateman wrote:
http://cr.openjdk.java.net/~pconcannon/8243488/webrevs/webrev.02/
Another approach would be replace DSF with a simple supplier like this:
@FunctionalInterface
interface DatagramSocketSupplier {
DatagramSocket get() throws IOException;
}
I don't understand your comment. Maybe I'm missing something?
That's exactly what DSF is isn't it?
We just choose to name the method 'open' instead of 'get'.
And the static `DSF of(DSF)` method is simply there to provide
a type witness and avoid a cast (you get a compilation error
otherwise).
In other words - we could possibly replace
{ "..", DSF.of(() -> new DatagramSocket()) }
with
{ "..", (DSF)() -> new DatagramSocket() }
but
{ "..", () -> new DatagramSocket() }
will never compile.
best regards,
-- daniel