On 10/4/21 12:57, Сергей Цыпанов wrote:
in the code of HashSet(Collection) we have an optimization opportunity:
public HashSet(Collection c) {
map = new HashMap<>(Math.max((int) (c.size()/.75f) + 1, 16));
addAll(c);
}
instead of using addAll() inherited from j.u.Collection we c
Hello,
in the code of HashSet(Collection) we have an optimization opportunity:
public HashSet(Collection c) {
map = new HashMap<>(Math.max((int) (c.size()/.75f) + 1, 16));
addAll(c);
}
instead of using addAll() inherited from j.u.Collection we can use
c.forEach(this::add):
public H