// This is good
List<Integer> lst1 = new LinkedList<Integer>();
// This is not good
LinkedList<Integer> lst2 = new LinkedList<Integer>();
That's a bit strong.
I always recommend to use the most abstract thing that will work. That is, prefer an interface over an abstract class, an abstract class over a concrete class. But if you really need to use addFirst() then LinkedList is the only "thing that will work." What you gain is access to methods that are found only on LinkedList. Using the LinkedList type is the only way to use that method, so it absolutely has to be done sometimes. What you lose is the flexibility to use this chunk of code with an ArrayList. It happens.
[ July 22, 2006: Message edited by: Stan James ]
[ July 23, 2006: Message edited by: Stan James ]