728x90
HashMap
1. 최대 최소값 구하기
Integer maxKey = Collections.max(map.keySet());
Integer minKey = Collections.min(map.keySet());
ArrayList
1. 최대 최소값 구하기
Integer max = list.stream().mapToInt(a->a).max().getAsInt();
Integer min = list.stream().mapToInt(a->a).min().getAsInt();
HashSet
1. 최대 최소값 구하기
Integer max = set.stream().mapToInt(a->a).max().getAsInt();
Integer min = set.stream().mapToInt(a->a).min().getAsInt();
728x90
'알고리즘 저장소 (일반방식과 나만의 풀이) > JAVA' 카테고리의 다른 글
[백준] no1620: 나는야 포켓몬 마스터 이다솜 (1) | 2023.02.02 |
---|---|
[백준] no1107: 리모컨 (0) | 2023.01.31 |
[공식] 팩토리얼 (Factorial) (0) | 2023.01.29 |
[백준] no1676: 팩토리얼 0의 개수 (1) | 2023.01.29 |
[백준] no7662: 이중 우선순위 큐 (0) | 2023.01.29 |