Results 1 to 3 of 3
Thread: A simple List question
- 02-16-2009, 04:24 AM #1Member
- Join Date
- Feb 2009
- Rep Power
Yes. It constructs a new ArrayList which is also a List.
List is an interface and can't be constructed directly. ArrayList is a class that implements the List interface. By coding this way, if you later decide that you would prefer to use a LinkedList instead of an ArrayList, you only have to change minimal code. The variable still remains a List and none of the uses of the variable change.
- By jigglywiggly in forum New To JavaReplies: 3Last Post: 01-26-2009, 02:17 AM
- By CirKuT in forum New To JavaReplies: 4Last Post: 12-10-2008, 07:56 PM
- By Rageagainst20 in forum New To JavaReplies: 0Last Post: 12-21-2007, 12:40 AM
- By ibanez270dx in forum New To JavaReplies: 0Last Post: 11-16-2007, 02:27 AM
- By carl in forum AWT / SwingReplies: 1Last Post: 08-07-2007, 07:07 AM