I've wrote this function in Java:
public void calculateMax(Integer year){
Double max = hoodDataList.get(0).getPercentage();
if(year == 2006){
for(Integer z = 0; z < hoodDataList.size(); z ++){
if(hoodDataList.get(z).getYear() == 2006){
if(hoodDataList.get(z).getPercentage() > max){
max = hoodDataList.get(z).getPercentage();
}
}
}
}
Toast.makeText(getActivity(), String.valueOf(max),
Toast.LENGTH_LONG).show();
}
Now if I'm correct it should calculate the maximum value of the Percentages and store it inside a variable called max
but somehow it stops iterating after the second value