Relates :
|
The following line Collections.emptyList().sort((Comparator)null); Leads to Exception in thread "main" java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:203) at java.util.Collections$EmptyList.sort(Collections.java:4523) While the spec on j.u.List.sort(Comparator) says: "A null value indicates that the elements' natural ordering should be used" In the implementation this looks like a result of a copy-paste mistake. The following JCK test will fail: api/java_util/Collections/empty/EmptyListSort.html#EmptyListSort[elementSettingNotSupported_naturalSorting]