Sets do not allow the duplicate elements. Sets represents a collection of sorted elements. Some useful classes which implement List interface are – ArrayList, CopyOnWriteArrayList, LinkedList, Stack and Vector. Using lists, we can access elements by their integer index (position in the list), and search for elements in the list. Lists represents an ordered collection of elements. For example, List (indexed, ordered) and Set (sorted) interfaces implement this collection. It extends Iterable interface which adds support for iterating over collection elements using the “ for-each loop” statement.Īll other collection interfaces and classes (except Map) either extend or implement this interface. Collection interface provides all general purpose methods which all collections classes must support (or throw UnsupportedOperationException). CollectionĬollection interface is at the root of the hierarchy. The collections classes implement these interfaces and provide concrete functionalities. The Collections framework is better understood with the help of core interfaces. These collection classes provide very transparent support for all such operations using Collections APIs. The common operations in involve add, remove, update, sort, search and more complex algorithms. These ready-to-use collection classes solve lots of very common problems where we need to deal with group of homogeneous as well as heterogeneous objects. Java Collections framework is consist of the interfaces and classes which helps in working with different types of collections such as lists, sets, maps, stacks and queues etc. A collection, as name implies, is group of objects.