I keep coming across code where people instantiate a new ArrayList and assign it to the List interface, like this:
List names = new ArrayList&l
Such code doesn't use the List
class, it declares the variable as being of type List
. This is called abstraction
List
is an interface, which defines what methods the actual class has, without specifying which actual class is used.
Although not a big deal here, this practice can be very important, even essential in more complexes situations. It's good practice to always follow this pattern.