Commons Collections 简明教程

Apache Commons Collections - Overview

Commons 集合扩展了 Java 集合框架。它提供了若干功能,以简化集合处理。它提供了许多新的接口、实现和实用工具。

Commons Collections augments Java Collections Framework. It provides several features to make collection handling easy. It provides many new interfaces, implementations and utilities.

Commons 集合的主要功能如下:

The main features of Commons Collections are as follows −

  1. Bag − Bag interfaces simplifies the collections, which have multiple number of copies of each object.

  2. BidiMap − BidiMap interfaces provide Bi-Directional maps, which can be used to lookup values using keys or keys using values.

  3. MapIterator − MapIterator interface provide simple and easy iteration over maps.

  4. Transforming Decorators − Transforming decorators can alter every object of a collection as and when it is added to the collection.

  5. Composite Collections − Composite collections are used, where multiple collections are required to be handled uniformly.

  6. Ordered Map − Ordered Maps retain the order, in which elements are added in.

  7. Ordered Set − Ordered Sets retain the order, in which elements are added in.

  8. Reference map − Reference map allows key/values to be garbage collected under close control.

  9. Comparator implementations − Many Comparator implementations are available.

  10. Iterator implementations − Many Iterator implementations are available.

  11. Adapter Classes − Adapter classes are available to convert array and enumerations to collections.

  12. Utilities − Utilities are available to test or create typical set-theory properties of collections such as union, intersection. Supports Closure.