私はJava8でストリームをテストしていて、非常に不満な問題を抱えています。Java8ストリームマップ()関数の追加の括弧
List<String> words = Arrays.asList("Oracle", "Java", "Magazine");
List<String> wordLengths = words.stream().map((x) -> {
x.toUpperCase();
}).collect(Collectors.toList());
警告:
The method map(Function<? super String,? extends R>) in the type Stream<String> is not applicable for the arguments ((<no type> x) -> {})
これを何の警告を投げる
List<String> words = Arrays.asList("Oracle", "Java", "Magazine");
List<String> wordLengths = words.stream().map((x) -> x.toUpperCase())
.collect(Collectors.toList());
2つ目(ほぼ同じ): 私はうまくコンパイルしたコードを持っています追加のかっこが変更されましたか?
を使用することをお勧めします( https://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-LambdaBody) –
「警告」ではなくコンパイルの問題、*完全に別のもの – Eugene