admin管理员组

文章数量:1637239

完整报错如下:

Class 'Anonymous class derived from MapFunction' must either be declared abstract or implement abstract method 'map(T)' in 'MapFunction'

解决方案:

env.generateSequence(1,10).map(new MapFunction<Long, Object>()

鼠标挪动到<Long, Object>的右边,intellij就会在左侧有个红色的小灯泡,点击后就可以补全。

 

让ide自动补全:

import org.apache.flink.apimon.functions.MapFunction;
import org.apache.flink.streaming.api.environment.LocalStreamEnvironment;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class ControllingLatency
{


    public static void main(String[] args) throws Exception
    {

        LocalStreamEnvironment env = StreamExecutionEnvironment.createLocalEnvironment();
        env.setBufferTimeout(5);

        env.generateSequence(1,10).map(new MapFunction<Long, Object>() {
            @Override
            public Object map(Long aLong) throws Exception {
                return aLong*2;
            }
        }).setBufferTimeout(5).print();

    }


}

本文标签: abstractdeclaredXXXXimplementMapFunction