Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- 파이썬
- join()
- 프로그래머스스쿨
- 저장소
- synchronized
- GIT
- thread
- AssertJ
- 스프링부트
- 자바스크립트
- Docker Desktop
- class
- 클래스
- docker
- Java
- Python
- 메소드
- event
- 배열
- Dict
- array
- Swing
- c#
- 자바
- JavaScript
- SpringBoot
- JS
- StringBuilder
- SSL
- 객체
Archives
- Today
- Total
목록getOrDefault() (1)
정리노트
[자바/java] HashMap / key 값 중복 시, value 값 카운트 변경
package q7; import java.util.HashMap; public class Q7 { public static void main(String[] args) { String names[] = { new String("Kim"), new String("Kim"), new String("Choe"), new String("Park"), new String("Kim"), new String("Lee"), new String("Park") }; HashMap map = new HashMap(); for (String key : names) { map.put(key, map.getOrDefault(key, 0)+1); // getOrDefault(Key값, Default값) } System.out.p..
프로그래밍/Java
2023. 1. 28. 20:02