Versions

[{“Name”:“Java SE 1.2”,“GroupName”:null},{“Name”:“Java SE 1.3”,“GroupName”:null},{“Name”:“Java SE 1.4”,“GroupName”:null},{“Name”:“Java SE 5”,“GroupName”:null},{“Name”:“Java SE 6”,“GroupName”:null},{“Name”:“Java SE 7”,“GroupName”:null},{“Name”:“Java SE 8”,“GroupName”:null},{“Name”:“Java SE 9 (Early Access)”,“GroupName”:null}]

Introduction

The collections framework in java.util provides a number of generic classes for sets of data with functionality that can’t be provided by regular arrays.

Collections framework contains interfaces for Collection<O>, with main sub-interfaces List<O> and Set<O>, and mapping collection Map<K,V>. Collections are the root interface and are being implemented by many other collection frameworks.

Remarks

Collections are objects that can store collections of other objects inside of them. You can specify the type of data stored in a collection using Generics.

Collections generally use the java.util or java.util.concurrent namespaces.

Java 1.4.2 and below do not support generics. As such, you can not specify the type parameters that a collection contains. In addition to not having type safety, you must also use casts to get the correct type back from a collection.

In addition to Collection<E>, there are multiple major types of collections, some of which have subtypes.

Java 5 adds in a new collection type:

Java 6 adds in some new subtypes of collections.