Is it possible to have a HashMap return a default value for all keys that are not found in the set?
HashMap
In Java 8, use Map.getOrDefault. It takes the key, and the value to return if no matching key is found.
1.4m articles
1.4m replys
5 comments
57.0k users