i try to use an iterator but i think i don't understand how to use it.
package fr.codegym.task.task08.task0818;
import java.util.HashMap;
import java.util.Map;
/*
Réservé aux riches
*/
public class Solution {
public static HashMap<String, Integer> creerMap() {
HashMap<String, Integer> map = new HashMap<String, Integer>();
map.put("Jérôme", 1500);
map.put("Lionel", 1000);
map.put("Sabrina", 2000);
map.put("Jessica", 5300);
map.put("Vincent", 350);
map.put("Virginie", 700);
map.put("Martin", 150);
map.put("Damien", 950);
map.put("Mallory", 2300);
map.put("Frédérique", 1100);
return map;
//écris ton code ici
}
public static void supprimerElementMap(HashMap<String, Integer> map) {
HashMap<String, Integer> copie = new HashMap<String, Integer>(map);
iterator<Map.Entry<String, Integer> > itr = copie.entrySet().iterator();
String cle = itr.getKey();
int valeur = itr.getValue();
while (itr.hasNext )
Map.Entry<String, Integer> map = itr.next;
if (valeur < 500)
remove(HashMap<String, Integer>map); //écris ton code ici
}
public static void main(String[] args) {
}
}