코드굽는 타자기

map.getOrDefault().add() in Java not works 본문

Java

map.getOrDefault().add() in Java not works

bright-jun 2022. 5. 9. 00:17

https://stackoverflow.com/questions/64095419/map-getordefault-add-in-java-not-works

 

map.getOrDefault().add() in Java not works

The traditional code works well like below: Map<Integer, List<Integer>> map = new HashMap<>(); if (!map.containsKey(1)) { map.put(1, new ArrayList<>()); } map.get(1).add(...

stackoverflow.com

 

'Java' 카테고리의 다른 글

thread safe  (0) 2022.05.16
지연실행  (0) 2022.05.13
orElse vs orElseGet  (2) 2022.05.10
LocalDate vs LocalDateTime  (0) 2022.05.08
Bit manipulation in JAVA  (0) 2022.04.25
Comments