You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The suggested replacements are slightly wrong though for HashMap and HashSet.
The current suggested replacement, java.util.HashMap<>(int), will create a HashMap that can fit 75% of the given size before it is resized. The correct replacement is java.util.HashMap.<>newHashMap(int).
Similar for HashSet, it should be java.util.HashSet.<>newHashSet(int), not java.util.HashSet<>(int).
Java 19 introduced new static methods for creating maps and sets so that this (using
Maps
from Guava)can be replaced with
and similar for HashMap, HashSet, etc.
There's probably some similar Apache Commons methods that can be replaced as well.
The text was updated successfully, but these errors were encountered: