posted 12 years ago
because someday, you may want to use (for example) a LinkedList instead of an ArrayList.
Further, it is possible you may not even know the specific type of the object you get. If you use code from a 3rd party, you may just be given a static method called "getList()". You won't know if it is an ArrayList, a LinkedList, a FredsNewAndImprovedList, or what.
By using the interface reference, you don't NEED to know. Your code will work regardless of the specific subtype.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors