반응형
Stream ➡ 기본형 Stream
From | To | 변환 메서드 |
Stream<T> | IntStream LongStream DoubleStream |
mapToInt(ToIntFunction<T> mapper) MapToLong(ToLongFunction<T> mapper) MapToDouble(ToDoubleFunction<T> mapper) |
기본형 Stream ➡ Stream
From | To | 변환 메서드 |
IntStream LongStream DoubleStream |
Stream<Integer> Stream<Long> Stream<Double> |
boxed() |
Stream<T> | mapToObj(DoubleFunction<T> mapper) |
기본형 Stream ➡ 기본형 Stream
From | To | 변환 메서드 |
IntStream LongStream DoubleStream |
LongStream DoubleStream |
asLongStream() asDoubleStream() |
Stream ➡ 부분 Stream
From | To | 변환 메서드 |
Stream<T> IntStream |
Stream IntStream |
skip(long n) limit(long maxSize) |
두 개의 Stream ➡ Stream
From | To | 변환 메서드 |
Stream<T>, Stream<T> | Stream<T> | concat(Stream<T> a, Stream<T> b) |
IntStream, IntStream | IntStream | concat(IntStream a, IntStream b) |
LongStream, LongStream | LongStream | concat(LongStream a, LongStream b) |
DoubleStream, DoubleStream | DoubleStream | concat(DoubleStream a, DoubleStream b) |
Stream의 Stream ➡ Stream
From | To | 변환 메서드 |
Stream<Stream<T>> | Stream<T> | flatMap(Function mapper) |
Stream<IntStream> | IntStream | flatMapToInt(Function mapper) |
Stream<LongStream> | LongStream | flatMapToLong(Function mapper) |
Stream<DoubleStream> | DoubleStream | flatMapToDouble(Function mapper) |
Stream ➡ 병렬 Stream
From | To | 변환 메서드 |
Stream<T> IntStream LongStream DoubleStream |
Stream<T> IntStream LongStream DoubleStream |
parallel() // 스트림 -> 병렬 스트림 sequential // 병렬 스트림 -> 스트림 |
Stream ➡ Collection
From | To | 변환 메서드 |
Stream<T> IntStream LongStream DoubleStream |
Collection<T> | collect(Collectors.toCollection(Supplierfactory) |
List<T> | collect(Collectors.toList()) | |
Set<T> | collect(Collectors.toSet()) |
Collection ➡ Stream
From | To | 변환 메서드 |
Collection<T>, List<T>, Set<T> | Stream<T> | stream() |
Stream ➡ Map
From | To | 변환 메서드 |
Stream<T> IntStream LongStream DoubleStream |
Map<K, V> | collect(Collectors.toMap(Function key, Function value) collect(Collectors.toMap(Function key, Function value, BinaryOperator) collect(Collectors.toMap(Function key, Function value, BinaryOperator merge, Supplier mapSupplier) |
Stream ➡ 배열
From | To | 변환 메서드 |
Stream<T> |
Object[] | toArray() |
T[] | toArray(IntFunction<A[] generator) | |
IntStream LongStream DoubleStream |
int[] long[] double[] |
toArray() |
'◼ JAVA' 카테고리의 다른 글
[Java/자바] 접근제어자(Access Modifier)란? (0) | 2022.11.08 |
---|---|
[Java/자바] JUnit5란? (0) | 2022.11.08 |
[Java/자바] Stream(스트림)이란? 사용법 총정리 (0) | 2022.11.05 |
[우아한테크코스 백엔드 5기] 프리코스 1주차 회고 (온보딩) (2) | 2022.11.03 |
[Java/자바] 제네릭스(Generics)란 ? (0) | 2022.11.01 |