문제

What would streamToArray need to do in the following code?

IntStream stream = IntStream.range(0, 3);
int[] array = streamToArray(stream); // array = [0, 1, 2]
도움이 되었습니까?

해결책

IntStream has the member method toArray, that does exactly what you need:

IntStream stream = IntStream.range(0, 3);
int[] array = stream.toArray();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top