표준입력 (stdin)
실행옵션 (runtime option)
코드:
실행 »
표준입력/실행옵션
import java.util.Optional; import java.util.stream.*; public class prog { public static void main(String[] args){ Stream<String> stream1 = Stream.of("넷", "둘", "셋", "하나"); Stream<String> stream2 = Stream.of("넷", "둘", "셋", "하나"); Optional<String> result1 = stream1.reduce((s1, s2) -> s1 + "++" + s2); result1.ifPresent(System.out::println); String result2 = stream2.reduce("시작", (s1, s2) -> s1 + "++" + s2); System.out.println(result2); } }