This code is from Item 16 - Prefer interfaces to abstract classes (Effective Java Ed#1) - Page# 86
I am kind of puzzled by looking at this code. I have several doubts and by looking at the sun docs, I could answer few of them. Please help for the rest:
1. Is the code in the return statement over ridding the get/set/size methods - YES (got the answer after I checked the API docs and it says that these methods must be overridden). But I do not see extends anywhere?
2. AbstractList is an abstract class as per the API docs, how can a new be done on it without extending? (Line 1)
3. When and where the values from int a, gets assigned to Integer List? Within the object of AbstractList, where are these values kept? (May be I am posting a non-sense question, as not sure what is the behavior)
Probably after the explanation, I would also get why this implementation is termed as Adapter patter in the para below the code.
Thanks much for your effort. Didn't know java does so much for you!!
Although extending anonymous classes this way seems natural and common, but not sure when should this way of implicit instance variable should be used. Let me read bit more on this and if I found any good link will post here.