简体   繁体   English

Decimal128 的排序问题 | 不存在类型变量 U 的实例,因此 Decimal128 符合 Comparable<!--? super U-->

[英]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.

相关问题 Comparator - thenComparing() 方法产生'不存在 U 类型变量的实例,因此 Object 符合 Comparable<!--? super U--> ' - Comparator - thenComparing() method produces 'no instance(s) of type variable(s) U exist so that Object conforms to Comparable<? super U>' 将 Decimal128 序列化为 JSON - Serializing Decimal128 to JSON 不存在类型变量 U 的实例,因此 Foo 符合 CompletionStage - no instance(s) of type variable(s) U exist so that Foo conforms to CompletionStage<U> 不存在类型变量 U 的实例,因此 void 符合 U - No instance(s) of type variable(s) U exist so that void conforms to U 不存在类型变量U的实例,因此Optional <U>符合Response</u> - No instance(s) of type variable(s) U exist so that Optional<U> conforms to Response 不存在类型变量T的实例,因此ID符合Comparable <? super T> - No instance of type variable(s) T exist so that ID conforms to Comparable<? super T> 排序数组列表 - 不存在类型变量的实例,因此 K 符合 Comparable - Sorting Array Lists - no instance(s) of type variable(s) exist so that K conforms to Comparable 不存在类型变量U的实例,因此Row符合Iterable <? extends U> - no instance(s) of type variable(s) U exists so that Row conforms to Iterable<? extends U> 不存在类型变量 T 的实例,因此 Predicate<string> 符合谓词<!--? super T--></string> - no instance(s) of type variable(s) T exist so that Predicate<String> conforms to Predicate<? super T> 不存在类型变量 V 的实例,因此 ExpectedCondition<Boolean> 符合功能<? super WebDriver, V> - No instance(s) of type variable(s) V exist so that ExpectedCondition<Boolean> conforms to Function<? super WebDriver, V>
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM