Skip to content

Commit af3b4b8

Browse files
committed
[BAEL-3392] Formatted code examples for [BAEL-3392]
1 parent b264937 commit af3b4b8

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/debug/Example1.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package com.baeldung.streams.debug;
22

3-
import org.junit.Test;
3+
import static org.assertj.core.api.Assertions.assertThat;
44

55
import java.util.stream.IntStream;
66

7-
import static org.assertj.core.api.Assertions.assertThat;
7+
import org.junit.Test;
88

99
public class Example1 {
1010
@Test
1111
public void whenDebugging_thenInformationIsShown() {
1212
int[] listOutputSorted = IntStream.of(-3, 10, -4, 1, 3)
13-
.sorted()
14-
.toArray();
13+
.sorted()
14+
.toArray();
1515

1616
assertThat(listOutputSorted).isSorted();
1717
}

core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/debug/Example2.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
package com.baeldung.streams.debug;
22

3-
import com.baeldung.streams.debug.entity.Customer;
4-
import org.junit.Test;
3+
import static org.assertj.core.api.Assertions.assertThat;
54

65
import java.util.Arrays;
76
import java.util.List;
87
import java.util.Optional;
98
import java.util.stream.Stream;
109

11-
import static org.assertj.core.api.Assertions.assertThat;
10+
import org.junit.Test;
11+
12+
import com.baeldung.streams.debug.entity.Customer;
1213

1314
public class Example2 {
1415
@Test
1516
public void whenDebugging_thenInformationIsShown() {
1617
List<Optional<Customer>> customers = Arrays.asList(
17-
Optional.of(new Customer("John P.", 15)),
18-
Optional.of(new Customer("Sarah M.", 78)),
19-
Optional.empty(),
20-
Optional.of(new Customer("Mary T.", 20)),
21-
Optional.empty(),
22-
Optional.of(new Customer("Florian G.", 89)),
23-
Optional.empty());
18+
Optional.of(new Customer("John P.", 15)),
19+
Optional.of(new Customer("Sarah M.", 78)),
20+
Optional.empty(),
21+
Optional.of(new Customer("Mary T.", 20)),
22+
Optional.empty(),
23+
Optional.of(new Customer("Florian G.", 89)),
24+
Optional.empty()
25+
);
2426

25-
long numberOf65PlusCustomers = customers
26-
.stream()
27-
.flatMap(c -> c
28-
.map(Stream::of)
29-
.orElseGet(Stream::empty))
30-
.mapToInt(Customer::getAge)
31-
.filter(c -> c > 65)
32-
.count();
27+
long numberOf65PlusCustomers = customers.stream()
28+
.flatMap(c -> c.map(Stream::of)
29+
.orElseGet(Stream::empty))
30+
.mapToInt(Customer::getAge)
31+
.filter(c -> c > 65)
32+
.count();
3333

3434
assertThat(numberOf65PlusCustomers).isEqualTo(2);
3535
}

0 commit comments

Comments
 (0)