nested hashmaps of unknown depth java
问题 I have a requirement in which I need to have an nested hashmap. But the depth would be decided at run time. E.g. If at runtime, user says 3, then my hashmap should be like HashMap<String, HashMAp<String, HashMap<String, String>>> if he says 4 then HashMap<String, HashMAp<String, HashMap<String, HashMap<String, String>>>> Is there any way to implement this kind of functionality? Some other API or toolkit?? 回答1: Oh, this is almost certainly a very bad idea. You sound like you really want a tree