Documentation

The Java™ Tutorials
Trail: Collections

Lesson: Introduction to Collections课程:集合介绍

A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. 集合—有时称为容器—它只是一个将多个元素组合成单个单元的对象。Collections are used to store, retrieve, manipulate, and communicate aggregate data. 集合用于存储、检索、操作和传递聚合数据。Typically, they represent data items that form a natural group, such as a poker hand (a collection of cards), a mail folder (a collection of letters), or a telephone directory (a mapping of names to phone numbers). 通常,它们表示形成自然组的数据项,例如扑克手(卡片集合)、邮件文件夹(信件集合)或电话簿(姓名到电话号码的映射)。If you have used the Java programming language — or just about any other programming language — you are already familiar with collections.如果您使用过Java编程语言—或者几乎任何其他编程语言—您肯定已经熟悉了集合。

What Is a Collections Framework?什么是集合框架?

A collections framework is a unified architecture for representing and manipulating collections. 集合框架是用于表示和操作集合的一致性体系结构。All collections frameworks contain the following:所有集合框架都包含以下内容:

Apart from the Java Collections Framework, the best-known examples of collections frameworks are the C++ Standard Template Library (STL) and Smalltalk's collection hierarchy. 除了java集合框架之外,集合框架最著名的例子是C++标准模板库(STL)和SimultActs的集合层次结构。Historically, collections frameworks have been quite complex, which gave them a reputation for having a steep learning curve. 从历史上看,集合框架相当复杂,这给了它们陡峭的学习曲线的声誉。We believe that the Java Collections Framework breaks with this tradition, as you will learn for yourself in this chapter.我们相信Java集合框架打破了这一传统,您将在本章中亲自学习。

Benefits of the Java Collections FrameworkJava集合框架的好处

The Java Collections Framework provides the following benefits:Java集合框架提供了以下好处:


Previous page: Table of Contents
Next page: Interfaces