java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
ArrayList is empty. It does not contain any element.
Index: 0, Size: 0.
You are trying to access it.So you are getting IndexOutOfBoundsException
.
if(r.size() == 0) && r.size() < pointer + 1) //If ArrayList size is zero then simply return from method.
return;