KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've declared the following hashmap: HashMap<Integer, Hive> hives Where Hive is an object. If I call "hives.get(2)" will it return a copy of the object Hive at that location or a reference to it? My goal is to modify the Hive object at that location. If it returns the reference, I can just modify the returned hive and be done. However, if a copy gets returned then I'll have to put that copy back into the hashmap. Sorry for the simple question. I tried looking around for a solution, but everywhere I looked it simply said the value would be returned, it didn't say if it would be a copy of the value or a reference to it. Thanks, Zain
Tags (comma-separated)
Save Edits
Cancel