The initialization of the toBounds collector is invalid.
public static <P extends Point> Collector<P, ?, Bounds> toBounds() {
return Collector.of(
() -> {
final double[] a = new double[4];
a[0] = Double.MAX_VALUE;
a[1] = Double.MAX_VALUE;
a[2] = Double.MIN_VALUE;
a[3] = Double.MIN_VALUE;
return a;
},
...
}
The correct initialization is
public static <P extends Point> Collector<P, ?, Bounds> toBounds() {
return Collector.of(
() -> {
final double[] a = new double[4];
a[0] = Double.MAX_VALUE;
a[1] = Double.MAX_VALUE;
a[2] = -Double.MAX_VALUE;
a[3] = -Double.MAX_VALUE;
return a;
},
...
}
This leads to erroneous bounds for negative latitude and longitude values.
The initialization of the
toBoundscollector is invalid.The correct initialization is
This leads to erroneous bounds for negative latitude and longitude values.