3 ms·
> groovys's safe navigation operator a?.getB()?.getC() Apache Groovy also has shortcut property syntax so you can write `a?.b?.c` to get the same effect. Of co
by vorg 8y ago
> groovys's safe navigation operator a?.getB()?.getC()
Apache Groovy also has shortcut property syntax so you can write `a?.b?.c` to get the same effect. Of course, all the syntactic sugar mixed together becomes quite confusing quite quickly. Some Groovers want to write the `?` once only and have it ripple through so you'd only need write `a?.b.c` in Groovy 3. But then, what if you actually want an NPE if `getB()` works but `getC()` doesn't? Perhaps `a?.b¿.c` would do the trick!