Will similar Strings in HashMap lead to increased chance of collisions?
问题 Consider the following: HashMap<String, Object> hm = new HashMap<>(); final String prefix = "My objects "; int counter = 0; void put(Object value) { hm.put(prefix+(counter++), value); } Given that the key of each entry starts with the same string and only differs by a number appended to it, is this likely to lead to more collisions? I'm trying to decide whether this way of creating unique keys is a good idea from a performance perspective. 回答1: No it will not. And that is not necessarily