xxxx must either be declared abstract or implement abstract method ‘map(T)‘ in ‘MapFunction‘
完整報(bào)錯(cuò)如下:
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>()
鼠標(biāo)挪動(dòng)到<Long, Object>的右邊,intellij就會(huì)在左側(cè)有個(gè)紅色的小燈泡,點(diǎn)擊后就可以補(bǔ)全。
?
讓ide自動(dòng)補(bǔ)全:
import org.apache.flink.api.common.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();
? ? }
}
總結(jié)
以上是生活随笔為你收集整理的xxxx must either be declared abstract or implement abstract method ‘map(T)‘ in ‘MapFunction‘的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: csgo录像在哪个文件夹 玩csgo最低
- 下一篇: flink的datastream输出没有