Documentation Contents

Collections Framework Enhancements

This page summarizes enhancements to the collections framework in version 5 of the JDK.

Three new language features significantly enhance the collections framework:

Three new collection interfaces are provided:

Two new concrete Queue implementations are provided, one existing List implementation has been retrofitted to implement Queue, and one abstract Queue implementation is provided:

Five new BlockingQueue implementations are provided, all of which are part of java.util.concurrent:

One ConcurrentMap implementation is provided:

Special-purpose List and Set implementations are provided for use in situations where read operations vastly outnumber write operations and iteration cannot or should not be synchronized:

Special-purpose Set and Map implementations are provided for use with enums:

A new family of wrapper implementations is provided, primarily for use with generic collections:

Three new generic algorithms and one comparator converter were added to the Collections utility class:

The Arrays utility class has been outfitted with content-based hashCode and toString methods for arrays of all types. These methods complement the existing equals methods. Versions of all three methods are provided to operate on nested (or "multidimensional") arrays: deepEquals, deepHashCode, and deepToString. It is now trivial to print the contents of any array. The idiom for printing a "flat" array is:

    System.out.println(Arrays.toString(a));

The idiom for printing a nested (multidimensional) array is:

    System.out.println(Arrays.deepToString(a));

Finally, Boolean was retrofitted to implement Comparable.


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