hope someone could help me , I want to display my Last 5 object in my arraylist But , there is something wrong in my code :( , need help please
for(int i=savedPreventivemachineList.size()-1 ; i < 5 ; i--)
{
Listresult.add(savedPreventivemachineList.indexOf(i), interventionmachine);
}
savedPreventivemachineTopList=Listresult;
when I execute it shows me this error:
java.lang.IndexOutOfBoundsException: Index: -1, Size: 0
java.util.ArrayList.rangeCheckForAdd(Unknown Source)
java.util.ArrayList.add(Unknown Source)