Skip to content

Commit 028ac8d

Browse files
committed
Update README.md.
1 parent fe9f4df commit 028ac8d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@ These are provided as a less verbose alternative to similar methods defined by t
10801080
```java
10811081
var value = 123;
10821082

1083-
var a = Optional.ofNullable(null).orElse(Optional.ofNullable(null).orElse(value)); // 123
1083+
var a = Optional.ofNullable(null).orElse(value); // 123
10841084
var b = coalesce(null, () -> value); // 123
10851085
```
10861086

kilo-client/src/test/java/org/httprpc/kilo/util/OptionalsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class OptionalsTest {
2626
public void testCoalesce() {
2727
var value = 123;
2828

29-
var a = Optional.ofNullable(null).orElse(Optional.ofNullable(null).orElse(value)); // 123
29+
var a = Optional.ofNullable(null).orElse(value); // 123
3030
var b = coalesce(null, () -> value); // 123
3131

3232
assertEquals(a, b);
@@ -48,8 +48,8 @@ public void testMap() {
4848
public void testPerform() {
4949
var stringBuilder = new StringBuilder();
5050

51-
Optional.ofNullable("abc").ifPresent(stringBuilder::append);
52-
perform("def", stringBuilder::append);
51+
Optional.ofNullable("abc").ifPresent(stringBuilder::append); // abc
52+
perform("def", stringBuilder::append); // abcdef
5353

5454
perform(null, stringBuilder::append);
5555

0 commit comments

Comments
 (0)