Java - Change the value in a HashMap -
i have hashmap this: hashmap<uuid, customclass>
.
customclass has lot of properties make meaningfully unique. need able update value of key in map new instance of customclass. need call method called "customclass.clearinfo()" clears/nulls/zeros out values of properties accordingly.
the problem "put" method changes reference of value refer new instance, when call clearinfo(), hashed value cleared.
i need keep values before call clearinfo().
you can remove object using hashmap.remove(key)
method. can put new object in key have removed.
see documentation remove()
.
Comments
Post a Comment