SyntaxFix
Write A Post
Hire A Developer
Questions
I know, this is an old question. But just for the sake of completeness, the lambda version.
Map<String, List<Item>> items = new HashMap<>(); items.computeIfAbsent(key, k -> new ArrayList<>()).add(item);