如何遍历嵌套的HashMap?
这个 HashMap
的结构如下:
HashMap<String, HashMap<String, Student>>
当 Student
是一个包含变量 name
的对象时。例如,如果我的 HashMap 看起来像这样(以下不是我的代码,只是模拟 HashMap 可能的内容)
hm => HashMap<'S', Hashmap<'Sam', SamStudent>>
HashMap<'S', Hashmap<'Seb', SebStudent>>
HashMap<'T', Hashmap<'Thomas', ThomasStudent>>
我如何遍历所有单个字母键,然后是每个全名键,再提取学生的姓名?