美文网首页
利用java的stream流对中文进行排序

利用java的stream流对中文进行排序

作者: 尘埃里的玄 | 来源:发表于2023-08-17 10:42 被阅读0次

降序
List<Map<String, Object>> maps = partquotaPartmentService.listMaps(wrapper);

 collect = maps.stream().sorted((o1, o2) ->
                            Collator.getInstance(Locale.SIMPLIFIED_CHINESE).compare(o2.get(sortField).toString(), o1.get(sortField).toString())).collect(Collectors.toList());

升序

 collect = maps.stream().sorted((o1, o2) ->
                            Collator.getInstance(Locale.SIMPLIFIED_CHINESE).compare(o1.get(sortField).toString(), o2.get(sortField).toString())).collect(Collectors.toList());

相关文章

网友评论

      本文标题:利用java的stream流对中文进行排序

      本文链接:https://www.haomeiwen.com/subject/hrolmdtx.html