Skip to content

Commit 8457c2a

Browse files
committed
doc update comparing
1 parent 69fcbcc commit 8457c2a

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,26 @@ In `Map.Entry`:
5757
* `default V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction)`
5858
* `default V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction)`
5959
* `default V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction)`
60-
* `default V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction)`
60+
* `default V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction)`
61+
62+
# project description
63+
We provide tests for above mentioned methods.
64+
65+
1. comparing
66+
* sort entry set stream by keys
67+
```
68+
stream.sorted(Map.Entry.comparingByKey())
69+
```
70+
* sort entry set stream by keys in reverse order
71+
```
72+
stream.sorted(Map.Entry.comparingByKey((x, y) -> Integer.compare(y, x)))
73+
```
74+
* sort entry set stream by values
75+
```
76+
stream.sorted(Map.Entry.comparingByValue(Comparator.comparingInt(p -> p.getHobbies().size())))
77+
```
78+
* sort entry set stream by values in reverse order
79+
```
80+
.sorted(Map.Entry.comparingByValue(Comparator.<Person>comparingInt(p -> p.getHobbies().size()).reversed()))
81+
```
82+
1. processing

0 commit comments

Comments
 (0)