edit - second class does not have indexed based access, instead it implements iterable
Suppose a class structure like this:
public class Values
{
public int getValue(int i)
{
return values_[i];
}
private int[] values_;
}
and a second class like this
public class ValuesCollection implements Iterable
{
private Values[] valuesCollection_;
}
Is there a way using java8 streams API to operate statistics along each dimension for instance: sum, mean, min, max, range, variance, std, etc. For example [[2,4,8],[1,5,7],[3,9,6]], for getting min it would return [1,4,6]
The closest I can come up with is something like this:
public int[] getMin(ValuesCollection valuesCollection)
{
IntStream.range(0, valuesCollection.size()).boxed().collect(Collectors.toList())
.forEach(i -> {
List<Integer> vals = valuesCollection.stream()
.map(values -> values.getValue(i))
.collect(Collectors.toList());
// operate statistics on vals
// no way to return the statistics
});
}