最近,我更新的Java 8版本,但我有问题,比较器(版本7中的一切都工作):比较在Java 8
lastplace = Collections.max(place,
new Comparator<Place>() {
public int compare(Place o1,
Place o2) {
return (o1.getDateFrom()
.compareTo(o2.getDateFrom()));
}
});
现在比较需要继承其他方法(thenComparingInt,thenComparingLong等等),但我不需要它们
如何在几行代码中解决这个问题?
那么问题是什么?你至少试过编译代码吗?我想不是,因为如果你有,你会看到代码编译得很好。 – 2014-10-08 07:07:17