[Solved] Get the sum of elements of an ArrayList

[ad_1]

To get the sum of the elements as your question states, you can use streams.

int sum = history.stream()
    .filter(his->his.getRes().equals("Vundet"))
    .mapToInt(his->his.getWins()) // assuming this getter exists.
    .sum();

2

[ad_2]

solved Get the sum of elements of an ArrayList