04月24, 2020

Java - List 多字段排序

Comparator<XSalesUserVO> byOrder = Comparator.comparing(XSalesUserVO::getShowOrder);
Comparator<XSalesUserVO> byName = Comparator.comparing(XSalesUserVO::getUserName);
// 先以byOrder升序排列,再按照byName升序排列
salesUserVOS.sort(byOrder.thenComparing(byName));

本文链接:http://www.iuutech.com/post/1587718634551.html

-- EOF --

Comments