Possible Duplicate:
Type List vs type ArrayList in Java
Why is it recommended to do this:
List<String> myArrayList = new ArrayList<String>
or same with Map interface and HashMap class
rather than:
ArrayList<String> myArrayList = new ArrayList<String>
Because the consuming code of the
myArrayListvariable won’t be tied to a particular implementation of this interface.