List implements Collection. In other words, a List is a more specific type of Collection. Therefore anything that works on a Collection will also work on a List.
This is also the reason why you should declare your variables and methods to take the most general type of object as you can and still have the method function as intended. For example, let's say we declare this function
This is almost always poor practice. Why? Because a LinkedList behaves the same as an ArrayList, so why shouldn't it work in this method? Instead:
Or - if you don't need the operations specific to List, you could declare it a Collection. And an ArrayList passed in would still work, but now the code is far more flexible. If later on, you decide that a different data structure would be preferable, you only need change the declaration of your List. You don't need to go through and change all the different methods that do operations on it.
Also consider the following code:
Likewise, this is usually poor practice. Why do you need an ArrayList declared? You can declare it:
In the same way, when you create an interface and have multiple objects implementing it, you can declare a reference variable of that interface type instead of the concrete implementation. Then you can swap out implementation details however you wish, and know that it will still fulfill what you need.