I do not understand why it does not work
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() {
//écris ton code ici
HashMap<String, Integer> a = new HashMap<String, Integer>();
a.put("aa", 500);
a.put("a", 1010);
a.put("aaa", 1200);
a.put("baa", 102130);
a.put("ba", 10120);
a.put("b", 600);
a.put("bb", 2000);
a.put("bbb",4000);
a.put("bc", 3000);
a.put("cc", 1200);
return a;
}
public static void supprimerElementMap(HashMap<String, Integer> map) {
//écris ton code ici
for (Map.Entry<String, Integer> paire : map.entrySet())
{ // Clé
String cle = paire.getKey();
int valeur = paire.getValue();
// Valeur
if(valeur<500){
map.remove(paire.getKey());}
}
}
public static void main(String[] args) {
HashMap<String, Integer> b = creerMap();
supprimerElementMap(b);
}
}