package Static;
import java.util.HashMap;
import java.util.Map;
public class test {
public static void main(String[] args) {
Map<Integer, String> map = new HashMap<Integer, String>();
map.put(1, "90");
map.put(2, "80");
map.put(3, "70");
map.put(4, "60");
map.put(5, "50");
map.put(6, "40");
map.put(7, "30");
map.put(8, "20");
map.put(9, "10");
Map<Integer, String> map2=new HashMap<Integer, String>();
for (Integer key: map.keySet()) {
Integer newkey=key+(new Integer(map.get(key)));
map2.put(newkey, map.get(key));
}
System.out.println(map2);
Map<Integer, String> map3=new HashMap<Integer, String>();
for (Integer key : map2.keySet()) {
if(key<50||key>150) {
map3.put(key, map2.get(key));
}
}
System.out.println(map3);
}
}C:\Users\Administrator\Pictures\QQ浏览器截图 |