Altering hashCode of object inside of HashSet / HashMap
问题 I am relatively new to Java and am puzzled about the following thing: I usually add objects to an ArrayList before setting its content. I.e., List<Bla> list = new ArrayList<>(); Bla bla = new Bla(); list.add(bla); bla.setContent(); // content influences hashCode This approach works great. I am concerned whether this approach will give me trouble when used with HashSet s or HashMap s. The internal hash table get set at the time the object is added. What will happen if setContent() gets called