connect:可以连接相同数据类型的两种流,也可以连接不同数据类型的两种流
public class ConnectDemo {
public static void main(String[] args) throws Exception {
// 创建执行环境
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(1);
DataStreamSource<String> word = env.fromElements("a", "b", "c", "d");
DataStreamSource<Integer> num = env.fromElements(1,2, 3,4, 5);
ConnectedStreams<String, Integer> connectDs = word.connect(num);
System.out.println(connectDs);
env.execute();
}
}