小编nis*_*sth的帖子

java.lang.NoClassDefFoundError:org/apache/flink/streaming/api/scala/StreamExecutionEnvironment

package com.knoldus
import org.apache.flink.api.java.utils.ParameterTool
import org.apache.flink.streaming.api.scala._
import org.apache.flink.streaming.api.windowing.time.Time

object SocketWindowWordCount {

  def main(args: Array[String]) : Unit = {

    var hostname: String = "localhost"
    var port: Int = 9000

    try {
     val params = ParameterTool.fromArgs(args)
      hostname = if (params.has("hostname")) params.get("hostname") else "localhost"
      port = params.getInt("port")
    } catch {
      case e: Exception => {
        System.err.println("No port specified. Please run 'SocketWindowWordCount " +
          "--hostname <hostname> --port <port>', where hostname (localhost by default) and port " +
          "is the address of the text server") …
Run Code Online (Sandbox Code Playgroud)

scala intellij-idea apache-flink

6
推荐指数
2
解决办法
7853
查看次数

Collectors.toList() 显示错误“预期 3 个参数,但找到 1 个”

为什么我的收藏Collectors.toList()显示此错误:

预期 3 个参数,但发现 1 个

package com.knoldus;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.IntStream;


interface Cityeration<T> {
    public abstract List<T> Cityeration(List<T> first, List<T> Second);
}

public class ListMultiplication {
    public static void main(String s[]) {
        List firstList = Arrays.asList(1, 2, 3, 4, 5);
        List secondList = Arrays.asList(1, 2, 3, 4, 5);

        Cityeration c = (first, second) -> IntStream.range(0, first.size())
                        .map(i -> first.get(i) * second.get(i))
                        .collect(Collectors.toList());
    }
}
Run Code Online (Sandbox Code Playgroud)

java collections java-stream

5
推荐指数
1
解决办法
1482
查看次数