class Stock{
double profit;
double profitPercentage;
public double getProfit(){
retu profit;
}
public double getProfitPercentage(){
retu profitPercentage;
}
}
List<Stock> stocks = getAllStocks();
stocks.stream.collect(Collectors.summarizingDouble(Stock:getProfit)).getSum();
stocks.stream.collect(Collectors.summarizingDouble(Stock:getProfitPercentage)).getSum();
I could not find out way to do in single pass of stream. Any help or pointer should be good.
