Hi, guys!
Something is wrong with my code!
Please, help me!
Thank you in advance!
package com.codegym.task.task08.task0818;
import java.util.HashMap;
import java.util.Map;
/*
Only for the rich
*/
public class Solution {
public static HashMap<String, Integer> createMap() {
//write your code here
HashMap<String, Integer> list = new HashMap<String, Integer>();
list.put("Cristi1", 100);
list.put("Cristi2", 200);
list.put("Cristi3", 300);
list.put("Cristi4", 400);
list.put("Cristi5", 500);
list.put("Cristi6", 600);
list.put("Cristi7", 700);
list.put("Cristi8", 800);
list.put("Cristi9", 900);
list.put("Cristi10", 1000);
return list;
}
public static void removeItemFromMap(HashMap<String, Integer> map) {
//write your code here
for (Map.Entry<String, Integer> pair : map.entrySet()) {
//System.out.println(pair.getKey() + " - " + pair.getValue());
if (pair.getValue() < 500) {
map.remove(pair.getKey());
}
}
}
public static void main(String[] args) {
}
}
package com.codegym.task.task08.task0818;
import java.util.HashMap;
import java.util.Map;
/*
Only for the rich
*/
public class Solution {
public static HashMap<String, Integer> createMap() {
//write your code here
HashMap<String, Integer> list = new HashMap<String, Integer>();
list.put("Cristi1", 100);
list.put("Cristi2", 200);
list.put("Cristi3", 300);
list.put("Cristi4", 400);
list.put("Cristi5", 500);
list.put("Cristi6", 600);
list.put("Cristi7", 700);
list.put("Cristi8", 800);
list.put("Cristi9", 900);
list.put("Cristi10", 1000);
return list;
}
public static void removeItemFromMap(HashMap<String, Integer> map) {
//write your code here
for (Map.Entry<String, Integer> pair : map.entrySet()) {
//System.out.println(pair.getKey() + " - " + pair.getValue());
if (pair.getValue() < 500) {
map.remove(pair.getKey());
}
}
}
public static void main(String[] args) {
}
}