Consider the following code:
for(int i = 0;i < 200;i++)
{
ArrayList<Integer> currentList = new ArrayList<Integer>() {{
add(i);
}};
// do something with currentList
}
How will Java treat the class of currentList
? Will it consider it a different class for each of the 200 objects? Will it be a performance hit even after the first object is created? Is it caching it somehow?
I'm just curious :)