I'm doing some coursework for uni, I really should know this but I am unsure how I can update an object stored in a HashMap.
I have an abstract 'User' class that extends into 'Customer' and 'Staff' classes, instances of which are stored in a HashMap named 'mapUsers'.
The way I was thinking it could be done is saving the element to be modified into a temp 'User' object, on this temp instance I could modify the Object in any necessary way.
My real question is, will this update the object stored in the HashMap or will I have to remove the element stored in the HashMap and replace with the modified temp instance.
Is there an easier way to do this, I thought maybe something like
HashMap.get(index).performOperation();
something like that, where I can perform an operation without removing elements.