java checking for key existence in double nested hashmaps
<p>I have a double nested hashmap of hashmaps and want to check for key existence and place new values.  Currently I am nesting if statements to check for key existence at each level.  Is there a more efficient way to code this?</p>

<pre><code>HashMap&lt;Foo1, HashMap&lt;Foo2, HashMap&lt;Foo3, Double&gt;&gt;&gt; my_map = new HashMap&lt;Foo1, HashMap&lt;Foo2, HashMap&lt;Foo3, Double&gt;&gt;&gt;();

if (my_map.containsKey(foo1key)) {

    if (my_map.get(foo1key).containsKey(foo2key)) {

        if (my_map.get(foo1key).get(foo2key).containsKey(foo3key)) {

             return my_map.get(foo1key).get(foo2key).get(foo3key);
        }
    }
}

double foo3key = getValue();

// do the above steps again to put foo3key into map.
</code></pre>
