Merge pull request #6577 from eugenp/fix-formatting

formatting
This commit is contained in:
Loredana Crusoveanu 2019-03-23 21:11:34 +02:00 committed by GitHub
commit a5dfae0dc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 88 deletions

View File

@ -20,11 +20,7 @@ public class CollectorsUnitTest {
public void whenTeeing_ItShouldCombineTheResultsAsExpected() { public void whenTeeing_ItShouldCombineTheResultsAsExpected() {
List<Integer> numbers = Arrays.asList(42, 4, 2, 24); List<Integer> numbers = Arrays.asList(42, 4, 2, 24);
Range range = numbers.stream() Range range = numbers.stream()
.collect(teeing( .collect(teeing(minBy(Integer::compareTo), maxBy(Integer::compareTo), (min, max) -> new Range(min.orElse(null), max.orElse(null))));
minBy(Integer::compareTo),
maxBy(Integer::compareTo),
(min, max) -> new Range(min.orElse(null), max.orElse(null))
));
assertThat(range).isEqualTo(new Range(2, 42)); assertThat(range).isEqualTo(new Range(2, 42));
} }
@ -54,11 +50,12 @@ public class CollectorsUnitTest {
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o)
if (o == null || getClass() != o.getClass()) return false; return true;
if (o == null || getClass() != o.getClass())
return false;
Range range = (Range) o; Range range = (Range) o;
return Objects.equals(getMin(), range.getMin()) && return Objects.equals(getMin(), range.getMin()) && Objects.equals(getMax(), range.getMax());
Objects.equals(getMax(), range.getMax());
} }
@Override @Override
@ -68,10 +65,7 @@ public class CollectorsUnitTest {
@Override @Override
public String toString() { public String toString() {
return "Range{" + return "Range{" + "min=" + min + ", max=" + max + '}';
"min=" + min +
", max=" + max +
'}';
} }
} }
} }