Let's say that I have a LinkedHashMap<Integer,Point2D.Double>
, and I put a key and a value to it, like .put(2,new Point2D.Double(34,32));
My problem is that sometimes I need to put a key and a value in it that already exists, and the LinkedHashMap
replaces it.
Like, I already have the key 2
and the value Point2D.Double(34,32)
, and I need to add it another time.
Why is it replacing that key/value by adding the same to the map, and is there a way to solve this issue (maybe via another sort of map)?