Java Collection framework series tutorial 1: Collection framework Introduction

Source: Internet
Author: User

From: http://docs.oracle.com/javase/tutorial/collections/intro/index.html

A collection, or collection, is also called a container. It aggregates multiple elements into a unit. Collections is often used to store, retrieve, manipulate aggregated data, and communicate with aggregated data. In general, collections indicates a set of data items that form a natural set, such as playing cards, a mailbox (consisting of many messages), or a phone book. If you are familiar with Java or any other programming language, you may already be familiar with collections. Collection implementation before Java 1.2, including vector, hashtable, and array, but these earlier implementations do not include the collection framework.

So what is a collection framework? A collection framework represents the same architecture as a set of operations. All collection frameworks contain the following items:

Interface: indicates the abstract data type of the Set, ADT. The interface does not need to pay attention to the implementation details of the set when using the set. In object-oriented languages, interfaces generally form a hierarchical structure.

Implementation: the specific implementation of the Set interface. In fact, they are reusable data structures.

Algorithms: Perform Various meaningful calculations on objects that implement the set interface, such as searching and sorting. In fact, algorithms are reusable functional units.

In addition to the Java Collection framework, other well-known collection frameworks include C ++ STL and smalltalk. Historically, collection frameworks have steep learning curves due to their complexity, and therefore are notorious.

Benefits of using the Java Collection framework provides the following benefits:

REDUCE programming burden: by providing useful data structures and algorithms, the collection framework frees us from the underlying algorithms and focuses more on code logic.

Improve programming efficiency and quality: the Java Collection framework provides high-performance and high-quality implementations of various useful data structure algorithms. Since programmers are freed from their hard work to implement various data structures, they have more time to improve program quality and program performance.

Allow interoperability

Reduces the burden of learning and using new APIs

Reduces the burden of designing new APIs

Promote Software Reuse: new data structures that comply with standard set interfaces are inherently reusable. The same is true for new algorithms that operate on objects that implement the set interface.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.