Elvis operator correction in #234 - Roundup 09 - Project Coin

16 views
Skip to first unread message

Hamlet D'Arcy

unread,
Mar 26, 2009, 10:19:14 AM3/26/09
to The Java Posse
It doesn't look like anyone pointed this out yet... but the show and
show notes for #234 refer to .? as the elvis operator, which it is
not.

.? is the null safe dereference (or null safe member selection or
safe navigation operator). It is not called elvis.

?: is the elvis operator, which is a sort of short hand ternary
operator for dealing with nulls.

Neal Gafter's google doc on the topic does a good job differentiating
between the two: http://docs.google.com/Doc?docid=ddb3zt39_78frdf87dc&hl=en

Robert Fischer

unread,
Mar 26, 2009, 10:26:44 AM3/26/09
to java...@googlegroups.com
?. is the null safe dereference (not .?).

?: is the Elvis operator, so named because it's the start of the Elvis smiley: ?:)

~~ Robert Fischer.
Grails Training http://GroovyMag.com/training
Smokejumper Consulting http://SmokejumperIT.com
Enfranchised Mind Blog http://EnfranchisedMind.com/blog

Check out my book, "Grails Persistence with GORM and GSQL"!
http://www.smokejumperit.com/redirect.html

Reply all
Reply to author
Forward
0 new messages