//collectors와 Collections 차이
ArrayList<Integer> list = (ArrayList<Integer>) Arrays.stream(stuff).boxed().collect(Collectors.toList());
Collections.sort(list); //오름차순 정렬
Collectors
Collectors (Java Platform SE 8 )
Returns a Collector implementing a "group by" operation on input elements of type T, grouping elements according to a classification function, and returning the results in a Map. The classification function maps elements to some key type K. The collector p
docs.oracle.com
- 컬렉션의 stream을 처리하는 클래스
- 어떤 요소를 어떤 컬렉션에 수집할 것인가를 나타냄
- stream().collect() 메서드의 매개값
Collections
Collections (Java Platform SE 7 )
Rotates the elements in the specified list by the specified distance. After calling this method, the element at index i will be the element previously at index (i - distance) mod list.size(), for all values of i between 0 and list.size()-1, inclusive. (Thi
docs.oracle.com
- collection(List, Map, Set) 에 대해서만 작동하거나 collection을 반환하는 클래스
참고
1) https://daddyprogrammer.org/
[JAVA] Stream 필터링한 요소 수집(collect())
스트림은 최종 처리 단계에서 요소들을 수집하는 collect()를 제공하고 있다. 이 메소드를 이용하면 필요한 요소만 컬렉션으로 담을 수 있고, 요소들을 그룹핑한 후 집계(리덕션)할 수 있다. 필터
cornswrold.tistory.com
2) https://cornswrold.tistory.com/
[JAVA] Stream 필터링한 요소 수집(collect())
스트림은 최종 처리 단계에서 요소들을 수집하는 collect()를 제공하고 있다. 이 메소드를 이용하면 필요한 요소만 컬렉션으로 담을 수 있고, 요소들을 그룹핑한 후 집계(리덕션)할 수 있다. 필터
cornswrold.tistory.com
'부트캠프 기록 > Serction2' 카테고리의 다른 글
[데이터베이스] SQL (0) | 2022.10.06 |
---|---|
[네트워크]HTTP통신 (0) | 2022.10.05 |
[네트워크] 웹 애플리케이션 작동원리 (0) | 2022.10.01 |
[자료구조/알고리즘] 자료구조 (0) | 2022.09.27 |
[자료구조/알고리즘] 재귀 (0) | 2022.09.20 |