Not sure what you mean. I think you want to add to the nested map like the following:
nest.get(nestKey).put(nestedKey, nestedValue);
This is not possible because the get on outer map returns a map of type Map<?, ?>
. You cannot invoke the put method on it. The unbounded wildcard '?' should be used if you don't know the type of a Collection's contents but want to consider them as Objects. If you want to read and modify the contents, and the Map has heterogenous objects, you can just use raw type. That is something like:
Map<?, Map> nest;
Best way of course is (if possible), to use a homogeneous Map and specify its type. Eg. Map<String, String>