What is a List vs. an ArrayList? [duplicate]

List is in interface while ArrayList is a class.

See ArrayList, and List.

E.g, you can’t use this setup:

List<String> list = new List<String>();… Because it’s an interface.

However, this works:

ArrayList<String> arrayList = new ArrayList<String>();

Also… You can do as duffymo says below, which is more or less the same as implementing the List interface (making your own list implementation).

Leave a Comment