Type List vs type ArrayList in Java [duplicate]
This question already has answers here: What does it mean to “program to an interface”? (32 answers) Closed 2 years ago. (1) List<?> myList = new ArrayList<?>(); (2) ArrayList<?> myList = new ArrayList<?>(); I understand that with (1), implementations of the List interface can be swapped. It seems that (1) is typically used in an … Read more