Skip to content

Commit 4656866

Browse files
committed
add more sort
1 parent 0c3bdee commit 4656866

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ d.getDoubleOf(4); // is 8
3737
**sort** `sort(list, comparator)`
3838

3939
```java
40-
list.sort(Comparator.comparing(n -> n.length()));
40+
list.sort((a, b) -> a.length() - b.length())
41+
list.sort(Comparator.comparing(n -> n.length())); // same
42+
list.sort(Comparator.comparing(String::length)); // same
4143
//> [Bohr, Tesla, Darwin, Newton, Galilei, Einstein]
4244
```
4345

0 commit comments

Comments
 (0)