Map.Entry

			Random r = new Random();
			HashMap<Object, Integer> m1 = new HashMap<Object, Integer>();
			m1.put("Math", r.nextInt(100));
			m1.put("Physics", r.nextInt(100));
			m1.put("English", r.nextInt(100));
			m1.put("Chemistry", r.nextInt(100));
			System.out.println(m1);
			for (Map.Entry<Object, Integer> e : m1.entrySet()) {
				if (e.getValue() > 90)
					System.out.println(e.getKey() + "is good");
			}

 

你可能感兴趣的:(map)