打印指定的值相同的條目,比如我有以下我的HashMap,鍵(整數)和值(整數也):如何獲得和HashMap的
HashMap <Integer, Integer> mymap = new HasHmap <>();
mymap.put(1, 3);
mymap.put(2, 4);
mymap.put(3, 1);
mymap.put(4, 5);
mymap.put(5, 2);
打印輸出:match found! [1,3] [3,1]
是否有可能在我的HashMap中查找並打印這樣的比賽?你能教我如何?
究竟是什麼你想達到什麼目的?並請添加一些你已經嘗試過的代碼 – Jonathan
嗯是的,這是可能的。只需查看[API](https://docs.oracle.com/javase/8/docs/api/java/util/Map.html)。 – Mena