[Java, stream] Sort object list in Japanese by property name

I want to sort the list of objects in Japanese by property name!

――Because it's a good idea (?) With stream api

Implementation environment

Development PC: Windows 10 Java: 8

List The model list is already stored in modelList

--Japanese name is included in Model.name

	Collator collator = Collator.getInstance( Locale.JAPANESE );
	collator.setStrength(Collator.IDENTICAL);
	collator.setDecomposition(Collator.FULL_DECOMPOSITION);
	List<Model> kanaSortedModelList = modelList.stream()
		.sorted(Comparator.comparing(Model::getName, Comparator.nullsLast(collator)))
		.collect(Collectors.toList());

Comparator.naturalOrder () was a bit unnatural in unicode order ...

Recommended Posts

[Java, stream] Sort object list in Japanese by property name
[java] sort in list
Sort by multiple conditions using Java Stream
Immutable (immutable) List object conversion function in Java8
Java Japanese (Kanji) Sort
[Neta] Sleep Sort in Java
Java Stream API in 5 minutes
Use Redis Stream in Java
List aggregation in Java (Collectors.groupingBy)
[Java8] Sort int type array in descending order using stream
Java List Group, Sort, etc.
Sort List in descending order in Java and generate a new List non-destructively
Concatenate strings returned by methods of multiple objects in Java Stream
[Java] Returns a Japanese name file in filename of HTTP header
Sort a List of Java objects
List of members added in Java 9
Sort in List, for personal notes
How to name variables in Java
List of types added in Java 9
Java array / list / stream mutual conversion list
Java8 list conversion with Stream map
Do you use Stream in Java?
How to get Excel sheet name list in Java (POI vs SAX)
Duplicate Map sorted by key in Java
Try using the Stream API in Java
Change List <Optional <T >> to Optional <List <T >> in Java
Arrylist and linked list difference in java
Process every arbitrary number in Java List
Sort by multiple fields in the class
Do not declare variables in List in Java
Implemented basic search / sort algorithm in Java
[Java] Various methods to acquire the value stored in List by iterative processing