The Collections interface
The Collections interface is the root interface extended by most collection types and defines common methods for all collection types. Interfaces and concrete implementations of a list, set and queue will inherit these common methods from the collection interface. It is important to note that some methods are optional and while they may appear on an implementation, it is possible that a call to one of these methods will throw an unsupported operation exception.
Collection Typing
The interfaces in the collection framework and the collection interface itself are generic. When creating a collection, a generic type argument is used to indicate the type of elements that it contains. The argument is declared by placing the type in angle brackets <>. Since the collection implementations are based on these interfaces, they use a generic type as well.
Collection<String> c = new ArrayList<String>();
When instantiating the implementation, we can be concise by using the diamond operator on the constructor which will infer the generic type from the declared variable’s generic type.
This generic type impacts how we use collection methods because it determines what arguments may be passed into them or what type of object they might return.
Collection interface methods


