- 중간 연산
: 연산결과가 스트림인 연산. 반복적으로 적용 가능- 최종연산
: 연산결과가 스트림이 아닌 연산. 단, 한번만 적용 가능(스트림의 요소를 소모)
String[] strArr = { "dd", "aaa", "CC", "cc", "b" };
Stream<String> stream = Stream.of(strArr); //문자열 배열이 소스인 스트림
Stream<String> filterStream = stream.filter(); //걸러내기
Stream<String> distinctedStream = stream.distinct();//중복제거
Stream<String> sortedStream = stream.sort(); //정렬
Stream<String> limitedStream = stream.limit(5); //스트림 자르기
int total = stream.count(); //요소 개수 세기(최종연산)