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