什么是map接口的多态引用?

q0qdq0h2  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(243)

多态引用中的Map接口
这是在多态引用中使用map接口的示例吗?

//some code here

Map<String, List<String>> adtDictionary;

//some code here

adtDictionary = new HashMap<String, List<String>>();

           while (departmentScanner.hasNextLine()) {
               String department = departmentScanner.nextLine().trim();
               adtDictionary.put(department, new ArrayList<String>());
           }

           while (facultyScanner.hasNextLine()) {
               String faculty = facultyScanner.nextLine();
               String[] values = faculty.split(",");
               adtDictionary.get(values[1].trim()).add(values[0]);
           }
//some code here

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题