Author Login
Post Reply
pexatus schrieb:
> I have a map of maps, so that it can be used like a generalization of a 2D
> array; i.e.
>
> def map = ['a':['b':'c'], 'd':['e':'f']]
>
> I want to use the safe dereference operator, but it does not work with the
> subscript operator. In other words, I want to do this;
>
> if (map['a']?['b'] != null) {
> // process map['a']['b']
> }
>
> But this does not work. Instead, I do this:
>
> if (map.getAt('a')?.getAt('b') != null) {
> // process map['a']['b']
> }
how about:
map.a?.b
bye blackdrag
--
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/
http://www.g2one.com/
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email