Why assign a new ArrayList to a List variable?
java
Solution
It's called programming to an interface. It allows you to substitute that `ArrayList` for a `LinkedList` if somewhere down the line you decide that a `LinkedList` would be more appropriate.
Problem
I am new to java and when I go through the code of many examples on net I see people declaring the variable for an `ArrayList` as simply `List` in almost all the cases. ``` List<String> myList = new ArrayList<String>(); ``` I don't understand if there is some specific advantage of doing this. Why can't it be an `ArrayList` itself, like so: ``` ArrayList<String> myList = new ArrayList<String>(); ```