I have this issue that to me seems strange:
Person p = null;
Supplier<String> s = p::getName; // Throws NPE immediately
Supplier<String> s2 = () -> p.getName();
s2.get(); // Throws NPE after get() call
How come both s and s2 are Suppliers, yet work so differently?
I'd expect s to throw NPE after calling s.get(), not immediately.
Why is that? What's happening here?
Thanks!