As the code shows: I don't understand why in the first map, the size is 100(after remove()), but in the second map, the size is 1 instead of 2. Is that because of the difference between data type stored in hashmap or?
public class test {
public static void main(String[] args) {
Map<Short, String> map = new HashMap<Short, String>();
for (short i = 0; i < 100; i++) {
map.put(i, String.valueOf(i));
map.remove(i - 1);
}
Map<Integer, Integer> hashmap = new HashMap<>();
hashmap.put(3,4);
hashmap.put(4,5);
hashmap.remove(3);
System.out.println(hashmap.size());
System.out.println(map.size());
}
}
Help me!