Documentation Contents

Collections Framework Enhancements

This page summarizes enhancements to the collections framework in Java SE 6.

This release saw fewer API changes than 5.0, but there was more of a focus on the accuracy and clarity of the specification. We recommend using the Java SE 6 specification even when writing programs for older releases.

The primary theme of the API changes was better bi-directional collection access.

These new collection interfaces are provided:

The following concrete implementation classes have been added:

These existing classes have been retrofitted to implement new interfaces:

Two new methods were added to the Collections utility class:

The Arrays utility class now has methods copyOf and copyOfRange that can efficiently resize, truncate, or copy subarrays for arrays of all types.

Before:

int[] newArray = new int[newLength];
System.arraycopy(oldArray, 0, newArray, 0, oldArray.length);

After:

int[] newArray = Arrays.copyOf(a, newLength);

Oracle and/or its affiliates Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved.
Contact Us