void displayFeedback(){ Map<String, Integer> maths = new HashMap<String, Integer>(); maths.put("Nirmala", 70); maths.put("Subaksha", 80); Map<String, Integer> english = new HashMap<String, Integer>(); english.put("Nirmala", 75); english.put("Subaksha", 60); //same staffs taking two different subjects maths and english //values taken as feedback for each subject // i need to compare both subject feedback and print only max as o/p System.out.println(maths); System.out.println(maths.entrySet()); //maths. //maths.entrySet(); //Collections.max(coll, comp) Map<String, Integer> top = new HashMap<String, Integer>(); System.out.println(maths.size()); for (Map.Entry<String, Integer> math: maths.entrySet()){ for (Map.Entry<String, Integer> eng: english.entrySet()){ //for(int i = 0;i<maths.size();i++){ //math.comparingByValue() System.out.println(math.getValue()+" "+eng.getValue()); //Collections.max(math.getValue(), eng.getValue()); if(math.getValue() <= eng.getValue()){ //System.out.println(" math <= eng"); }else { //System.out.println("math > eng"); }在这两种地图中,教师是共同的,他们既处理数学又涉及英语科目,并且他们在每个下层的反馈都作为这两种科目的值我需要比较并找到最大反馈值,并仅将最大值打印给每位老师.... t老师在两个图中都是通用键
添加回答
举报
0/150
提交
取消