// 自定义函数 class MyMapFunction implements MapFunction二、使用匿名类{ public Integer map(String value){ return Integer.parseInt(value); } };
// 可以将函数作为匿名类进行传递 data.map(new MapFunction三、使用Java8的Lambda表达式(){ public Integer map(String value){ return Integer.parseInt(value); } });
data.filter(s -> s.startsWith("http://"));
// Reduce聚合转换算子
data.reduce((i1,i2) -> i1 + i2)
四、使用富函数
继承富函数
class MyMapFunction extends RichMapFunction{ public Integer map(String value) { return Integer.parseInt(value); } }
将函数传递给Map
data.map(new MyMapFunction());
将富函数定义为匿名类
data.map(new RichMapFunction(){ public Integer map(String value){ return Integer.parseInt(value); } })



