ones.updateStateByKey(new Function2<List<Integer>, Optional<Integer>, Optional<Integer>>() {
            @Override
            public Optional<Integer> call(List<Integer> arg0, Optional<Integer> arg1) throws Exception {
                // TODO Auto-generated method stub
                return null;
            }
        });

对JavaPairDStream<String, Integer> ones使用updateStateByKey报错:

The method updateStateByKey(Function2<List<Integer>,Optional<S>,Optional<S>>) in the type JavaPairDStream<String,Integer> is not applicable for the arguments (new Function2<List<Integer>,Optional<Integer>,Optional<Integer>>(){})

 

解决办法:很可能是Optional导包导错了,要导com.google.common.base.Optional

相关文章:

  • 2021-04-12
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2021-06-22
  • 2021-08-01
  • 2022-12-23
  • 2021-08-13
猜你喜欢
  • 2021-10-05
  • 2022-01-13
  • 2021-09-30
  • 2021-12-21
  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
相关资源
相似解决方案