import java.util.*;
class TreeMapDemo
{
public static void main(String args[])
{
Comparator <String> c1 = (str1, str2) -> 0;
Comparator <String> c2 = (str1, str2) -> 1;
TreeMap <String, Double> tm1 = new TreeMap(c1.thenComparing(c2));
//Working fine
TreeMap <String, Double> tm2 = new TreeMap(((str1, str2) -> 0).thenComparing((str1, str2) -> 1));
//Error: Lambda expression not expected here
//<none> can not be dereferenced
}
}
私のクエリは次のとおりです。
もしも
c1 = (str1, str2) -> 0そしてc2 = (str1, str2) -> 1、
それでなんで
c1.thenComparing(c2)正常に動作しており、
((str1, str2) -> 0).thenComparing((str1, str2) -> 1)ではありません?