I want to declare an ArrayList within another ArrayList.
I declared ArrayList of ArrayList and added the elements in the following manner successfully but at the time of retrieval its showing class cast exception.
List<List<UnderDefinedFunction> parentAL=new ArrayList<List<UserDefinedFunction>>();
List<UserdefinedFunction> childAL=new ArrayList<UserDefined>();
childAL.add(userdefinedfunction);
...............
..............
parentAL.add(childAL);
At the time of retrieval it is showing class cast exception.
for(int i=0;i<parentAL.size();i++){
List<UserDefinedFunction> al=parentAL.get(i);
}
I tried with following code also:
ArrayList<ArrayList<UserDefinedfunction> al=new ArrayList<ArrayList<UserDefinedFunction>>();
but I am getting same problem.
Why is it showing any error any mistake is done any idea ???