Not being able to find the reason for exception


#1

not being able to find the reason for indexoutofbounds exception
public class Solution {
ArrayList<ArrayList>result=new ArrayList<ArrayList>();
public ArrayList<ArrayList> subsets(ArrayList A) {
ArrayListsubset=new ArrayList();
helper(subset,A,0);
return result;
}
public void helper(ArrayListsubset,ArrayList A,int i)
{
if(i==A.size())
{
result.add(subset);
return;
}
else
{
helper(subset,A,i+1);
subset.set(i,A.get(i));
helper(subset,A,i+1);
}

}

}