The method arrayList.size() returns the number of items in the list – so if the index is greater than or equal to the size(), it doesn’t exist.
if(index >= myList.size() || index < 0){
//index does not exists
}else{
// index exists
}
The method arrayList.size() returns the number of items in the list – so if the index is greater than or equal to the size(), it doesn’t exist.
if(index >= myList.size() || index < 0){
//index does not exists
}else{
// index exists
}