当前位置:网站首页>Stream Chinese sorting
Stream Chinese sorting
2022-06-11 21:08:00 【m0_ fifty-one million seven hundred and three thousand and eigh】
public class Test {
public static void main(String[] args) {
Collator collator = Collator.getInstance(Locale.CHINA);
List<String> list = new ArrayList();
list.add(" Zhang San ");
list.add(" Wang Wu ");
list.add(" Zhao Liu ");
list.add(" Mengsi ");
System.out.println("list = " + list);
// list = [ Zhang San , Wang Wu , Zhao Liu , Mengsi ]
// positive sequence
List<String> sortedList = list.stream()
.sorted(Comparator.comparing(a -> a, collator))
.collect(Collectors.toList());
System.out.println("sortedList = " + sortedList);
// sortedList = [ Mengsi , Wang Wu , Zhang San , Zhao Liu ]
// In reverse order
List<String> resortedList = list.stream()
.sorted(Comparator.comparing(a -> a, collator).reversed())
.collect(Collectors.toList());
System.out.println("resortedList = " + resortedList);
// resortedList = [ Zhao Liu , Zhang San , Wang Wu , Mengsi ]
}
}
边栏推荐
- Interviewer: what is the event flow and event model in JS?
- Go语言函数
- One article to show you how to understand the harmonyos application on the shelves
- ORA-04098: trigger ‘xxx.xxx‘ is invalid and failed re-validation
- Use float to create a page header, footer, left content, and main content.
- Figure guessing game
- 银泰百货与淘宝天猫联合打造绿色潮玩展,助力“碳中和”
- Weekly 02 | pour être honnête, je suis un étudiant du MIT
- Field queryIndexFieldnameService in xxxImpl required a single bean, but 19 were found:
- Cs144 lab0 lab1 record
猜你喜欢

频域滤波器

Redis第四话 -- redis高性能原理(多路复用)和高可用分析(备份、主从)

Chinese text classification based on CNN

Online excel file parsing and conversion to JSON format

Cs144 lab0 lab1 record

The input value "18-20000hz" is incorrect. The setting information is incomplete. Please select a company

JVM方法区

【博弈论-完全信息静态博弈】 战略式博弈

Wechat applet | rotation chart

Part I physical layer
随机推荐
Mysql add 新增多个新字段并指定字段位置
Deploy website traffic statistics background based on Tencent cloud lightweight application server and umami
【博弈论-绪论】
How to manually drag nodes in the Obsidian relationship graph
[data visualization] use Apache superset to visualize Clickhouse data
【数据可视化】Apache Superset 1.2.0教程 (二)——快速入门(可视化王者英雄数据)
Obsidian关系图谱如何让节点可以手动拖动
Tensorflow 2. X Getting Started tutorial
为什么100G网络传输要使用iWARP、RoCE v2、NVMe-oF等协议
How to add text on the border in bar code software
Field queryIndexFieldnameService in xxxImpl required a single bean, but 19 were found:
Why should I use iwarp, roce V2, nvme of and other protocols for 100g network transmission
A man always becomes a man and a man always arrives (progress, harvest, growth, self-confidence)
【指标体系】最新数仓指标体系建模方法
ORA-04098: trigger ‘xxx. xxx‘ is invalid and failed re-validation
ASCII code comparison table
Toolbar替换ActionBar后Title不显示
JVM对象分配策略TLAB
JS monitor scrolling touch bottom load more_ Browser scrolls to the bottom to load more
为什么需要微服务