Groovy has the ?: operator called the Elvis operator because it looks a bit like Elvis Presley’s hair. Java does not support it. It is helpful in dealing with values that might be null. It is a shorcut for a common piece of code to deal with null values. If the Elvis operator were introduced to Java:
// Instead of writing: val = something != null ? something : defaultValue; // you would write: val = something ?: defaultValue;
This page is posted |
http://mindprod.com/jgloss/elvisoperator.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\elvisoperator.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[3.15.17.60] |
| |
Feedback |
You are visitor number | |