eclipse 预期省略分号和右括号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36157340/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:05:39  来源:igfitidea点击:

ElidedSemicolonAndRightBrace expected

javaeclipsejava-stream

提问by stefan.m

I have the following code ("codes" is an array variable):

我有以下代码(“代码”是一个数组变量):

Arrays.asList(codes)
        .stream()
        .filter(code -> code.hasCountries())
        .sorted()
        .toArray()
        );

The compiler gives me the following error:

编译器给了我以下错误:

Syntax error on token ")", ElidedSemicolonAndRightBrace expected

标记“)”上的语法错误,应为 ElidedSemicolonAndRightBrace

What's wrong here?

这里有什么问题?

回答by stefan.m

This error simply means that you have too many closing parenthesis. The code should be:

这个错误只是意味着你有太多的右括号。代码应该是:

Arrays.asList(codes)
        .stream()
        .filter(code -> code.hasCountries())
        .sorted()
        .toArray();