admin管理员组文章数量:1636921
完整报错如下:
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
版权声明:本文标题:xxxx must either be declared abstract or implement abstract method ‘map(T)‘ in ‘MapFunction‘ 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1729233333a1191704.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论