I want to add treemaps to an arraylist in java. Here's what I am doing:
ArrayList al=new ArrayList();
for(int i=0;i<n;i++)
{
al.add(new TreeMap());
}
the when I try to add key value pairs to the treemap:
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
al.get(i).put(j,(arr[j]-arr[i]));
}
}
The compiler gives error in this: error description
can someone please help me out.... Thanks.
this question is different from What is a raw type and why shouldn't we use it? because here I am not asking for an explanation of raw types or generics, but I am asking for the solution of an error.