Optional != @Nullable
Zhong Yu
zhong.j.yu at gmail.com
Sun Sep 30 13:19:33 PDT 2012
On Sun, Sep 30, 2012 at 2:54 PM, Sam Pullara <sam at sampullara.com> wrote:
static String address(InetSocketAddress sa) {
return elvis(elvis(sa, sa -> sa.getAddress()), ia ->
ia.getHostAddress());
}
compared to Jed's syntax (to be fair, assume getAddress() etc all
return Option<> type)
static Option<String> address(Option<InetSocketAddress> sa) {
return
sa.flatMap(sa->sa.getAddress()).flatMap(ia->ia.getHostAddress());
}
there isn't much difference in wordiness between the two camps.
So the real question is, returning Option<> is more strongly typed;
but is it *too* strongly typed? Would some people find it annoying
like C++'s const?
Zhong Yu
More information about the lambda-dev
mailing list