Skip to content

Commit 683fc56

Browse files
committed
formatting
1 parent a34d4f0 commit 683fc56

2 files changed

Lines changed: 82 additions & 88 deletions

File tree

‎core-java-12/pom.xml‎

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5-
<modelVersion>4.0.0</modelVersion>
6-
<groupId>com.baeldung</groupId>
7-
<artifactId>core-java-12</artifactId>
8-
<version>0.1.0-SNAPSHOT</version>
9-
<name>core-java-12</name>
10-
<packaging>jar</packaging>
11-
<url>http://maven.apache.org</url>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.baeldung</groupId>
7+
<artifactId>core-java-12</artifactId>
8+
<version>0.1.0-SNAPSHOT</version>
9+
<name>core-java-12</name>
10+
<packaging>jar</packaging>
11+
<url>http://maven.apache.org</url>
1212

13-
<parent>
14-
<groupId>com.baeldung</groupId>
15-
<artifactId>parent-modules</artifactId>
16-
<version>1.0.0-SNAPSHOT</version>
17-
</parent>
13+
<parent>
14+
<groupId>com.baeldung</groupId>
15+
<artifactId>parent-modules</artifactId>
16+
<version>1.0.0-SNAPSHOT</version>
17+
</parent>
1818

19-
<dependencies>
20-
<dependency>
21-
<groupId>org.assertj</groupId>
22-
<artifactId>assertj-core</artifactId>
23-
<version>${assertj.version}</version>
24-
<scope>test</scope>
25-
</dependency>
26-
</dependencies>
19+
<dependencies>
20+
<dependency>
21+
<groupId>org.assertj</groupId>
22+
<artifactId>assertj-core</artifactId>
23+
<version>${assertj.version}</version>
24+
<scope>test</scope>
25+
</dependency>
26+
</dependencies>
2727

28-
<build>
29-
<plugins>
30-
<plugin>
31-
<groupId>org.apache.maven.plugins</groupId>
32-
<artifactId>maven-compiler-plugin</artifactId>
33-
<version>${maven-compiler-plugin.version}</version>
34-
<configuration>
35-
<source>${maven.compiler.source.version}</source>
36-
<target>${maven.compiler.target.version}</target>
37-
</configuration>
38-
</plugin>
39-
</plugins>
40-
</build>
28+
<build>
29+
<plugins>
30+
<plugin>
31+
<groupId>org.apache.maven.plugins</groupId>
32+
<artifactId>maven-compiler-plugin</artifactId>
33+
<version>${maven-compiler-plugin.version}</version>
34+
<configuration>
35+
<source>${maven.compiler.source.version}</source>
36+
<target>${maven.compiler.target.version}</target>
37+
</configuration>
38+
</plugin>
39+
</plugins>
40+
</build>
4141

42-
<properties>
43-
<maven.compiler.source.version>12</maven.compiler.source.version>
44-
<maven.compiler.target.version>12</maven.compiler.target.version>
45-
<assertj.version>3.6.1</assertj.version>
46-
</properties>
42+
<properties>
43+
<maven.compiler.source.version>12</maven.compiler.source.version>
44+
<maven.compiler.target.version>12</maven.compiler.target.version>
45+
<assertj.version>3.6.1</assertj.version>
46+
</properties>
4747

4848
</project>

‎core-java-12/src/test/java/com/baeldung/collectors/CollectorsUnitTest.java‎

Lines changed: 42 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -16,62 +16,56 @@
1616
*/
1717
public class CollectorsUnitTest {
1818

19-
@Test
20-
public void whenTeeing_ItShouldCombineTheResultsAsExpected() {
21-
List<Integer> numbers = Arrays.asList(42, 4, 2, 24);
22-
Range range = numbers.stream()
23-
.collect(teeing(
24-
minBy(Integer::compareTo),
25-
maxBy(Integer::compareTo),
26-
(min, max) -> new Range(min.orElse(null), max.orElse(null))
27-
));
19+
@Test
20+
public void whenTeeing_ItShouldCombineTheResultsAsExpected() {
21+
List<Integer> numbers = Arrays.asList(42, 4, 2, 24);
22+
Range range = numbers.stream()
23+
.collect(teeing(minBy(Integer::compareTo), maxBy(Integer::compareTo), (min, max) -> new Range(min.orElse(null), max.orElse(null))));
2824

29-
assertThat(range).isEqualTo(new Range(2, 42));
30-
}
25+
assertThat(range).isEqualTo(new Range(2, 42));
26+
}
3127

32-
/**
33-
* Represents a closed range of numbers between {@link #min} and
34-
* {@link #max}, both inclusive.
35-
*/
36-
private static class Range {
28+
/**
29+
* Represents a closed range of numbers between {@link #min} and
30+
* {@link #max}, both inclusive.
31+
*/
32+
private static class Range {
3733

38-
private final Integer min;
34+
private final Integer min;
3935

40-
private final Integer max;
36+
private final Integer max;
4137

42-
Range(Integer min, Integer max) {
43-
this.min = min;
44-
this.max = max;
45-
}
38+
Range(Integer min, Integer max) {
39+
this.min = min;
40+
this.max = max;
41+
}
4642

47-
Integer getMin() {
48-
return min;
49-
}
43+
Integer getMin() {
44+
return min;
45+
}
5046

51-
Integer getMax() {
52-
return max;
53-
}
47+
Integer getMax() {
48+
return max;
49+
}
5450

55-
@Override
56-
public boolean equals(Object o) {
57-
if (this == o) return true;
58-
if (o == null || getClass() != o.getClass()) return false;
59-
Range range = (Range) o;
60-
return Objects.equals(getMin(), range.getMin()) &&
61-
Objects.equals(getMax(), range.getMax());
62-
}
51+
@Override
52+
public boolean equals(Object o) {
53+
if (this == o)
54+
return true;
55+
if (o == null || getClass() != o.getClass())
56+
return false;
57+
Range range = (Range) o;
58+
return Objects.equals(getMin(), range.getMin()) && Objects.equals(getMax(), range.getMax());
59+
}
6360

64-
@Override
65-
public int hashCode() {
66-
return Objects.hash(getMin(), getMax());
67-
}
61+
@Override
62+
public int hashCode() {
63+
return Objects.hash(getMin(), getMax());
64+
}
6865

69-
@Override
70-
public String toString() {
71-
return "Range{" +
72-
"min=" + min +
73-
", max=" + max +
74-
'}';
75-
}
76-
}
66+
@Override
67+
public String toString() {
68+
return "Range{" + "min=" + min + ", max=" + max + '}';
69+
}
70+
}
7771
}

0 commit comments

Comments
 (0)