Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maps and sets of given size after Java 19 #258

Open
snago opened this issue May 15, 2024 · 0 comments
Open

Maps and sets of given size after Java 19 #258

snago opened this issue May 15, 2024 · 0 comments

Comments

@snago
Copy link
Contributor

snago commented May 15, 2024

Java 19 introduced new static methods for creating maps and sets so that this (using Maps from Guava)

Map<String, String> map = Maps.newLinkedHashMapWithExpectedSize(numMappings);

can be replaced with

Map<String, String> map = LinkedHashMap.newLinkedHashMap(numMappings);

and similar for HashMap, HashSet, etc.

There's probably some similar Apache Commons methods that can be replaced as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant