[英]Sorting issue for Decimal128 | no instance(s) of type variable(s) U exist so that Decimal128 conforms to Comparable<? super U>
I was trying to sort a list according to a field which is Decimal 128 but getting "no instance(s) of type variable(s) U exist so that Decimal128 conforms to Comparable<? super U> " error.我试图根据 Decimal 128 的字段对列表进行排序,但得到“不存在 U 类型变量的实例,因此 Decimal128 符合 Comparable<? super U> ”错误。
odsALSAccBalHistoryListFinal =
alsBHSortLevel1
.stream()
.sorted(
Comparator.comparing(OdsALSAccBalHistory::getSrtCdeAccNum)
.thenComparing(OdsALSAccBalHistory::getYrMo, Comparator.reverseOrder()))
.collect(Collectors.toList());`
Data Type:数据类型:
Kindly suggest if there is a workaround for this.请建议是否有解决方法。
Change改变
Comparator.comparing(OdsALSAccBalHistory::getSrtCdeAccNum)
to至
Comparator.comparing((OdsALSAccBalHistory ods) -> ods.getSrtCdeAccNum().bigDecimalValue())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.