a big doubt! I read that HashMap takes references of objects and doesn't copy values to store data. So if I have something like
HashMap<Integer, Double> map = HashMap<Integer, Double>();
for(int i = 0; i < 100; i++ ) {
Integer key = Integer(i);
Double value = Double(i*2.0);
map.put(key, value);
}
What is the result of
map.get(10);
? Keys and values are created within the for loop so I suppose that they are deleted at the end of for statement and put(10) give something like null. But I think it's a very annoying behaviour because I can't fill a HashMap with a straighforward for loop... I'm wrong?
iidentifier, but they are not deleted.