import java.util.Optional;
import java.util.stream.Stream;
public class Program {
public static void main(String[] args) {
String <String> wordStream = Stream.of( "one", "two", "three");
String sentence = wordStream.parallel().reduce("Result:", (x,y)->x + " " + y);
System.out.println(sentence);
}
}
正如MC Emperor在评论中提到的。
public static void main(String[] args) {
Stream<String> wordStream = Stream.of( "one", "two", "three");
String sentence = wordStream.parallel().reduce("Result:", (x,y)->x + " " + y);
System.out.println(sentence);
}