The most important collection framework in Java

Source: Internet
Author: User

Java.util This important package contains a large number of classes and interfaces that support a lot of functionality. For example, Java.util has classes that produce pseudo-random numbers, as well as classes that can manage dates and times, observe events, manipulate bit sets, tag strings, manipulate formatted data, and so on. The Java.util package also contains one of the most powerful subsystems in Java: The collection Framework (collections framework). The following analyzes the interfaces and classes in the collection framework.

Collection interface:

  

Collection Allows processing of a set of objects located in the item part of the collection hierarchy
Deque Extending the queue interface to handle double-ended queues
List Extend the collection interface to process sequences (the list of elements that can contain duplicates)
Navigableset Extending the SortedSet interface to handle retrieval of elements based on the closest matching search
Queue Extends the collection interface to handle special types in the list, where the elements can only be removed from the previous
Set Extends the collection interface to handle collections in which the elements must be unique
SortedSet Extend the set interface to handle a sorted collection

In addition to the collection interface, the comparator, randomaccess, Iterator, and Listiterator interfaces are used in the collection. In short, the comparator interface defines how to compare two objects, iterator and Listiterator interfaces, to illustrate the objects in the collection.

There are several ways to note in the Queue Interface: poll () and remove () are both methods of deleting an element, the difference being that if the queue is empty, poll () returns NULL, and remove () throws an exception. There are also two ways to obtain but not delete the top element of the queue: element () and peek (). The difference is that if the queue is empty, element () throws an exception, and peek () returns NULL.

Collection class:

Abstractcollection Implement most collection interfaces
Abstractlist Extended abstractcollection to implement most of the list interfaces
Abstractqueue Extended abstractcollection to implement part of the queue interface
Abstractsequentiallist Extended Abstractlist, which is used in order to sequentially access the elements of the collection
LinkedList Implementing a linked list by extending Abstractsequentiallist
ArrayList Implementing dynamic arrays by extending Abstractlist
Arraydeque Dynamic double-ended queue with extended abstractcollection and implementation of Deque interface
Abstractset Extended abstractcollection to implement most of the set interfaces
Enumset Extended Abstractset, for enum elements
HashSet Extended Abstractset, for hash tables
Linkedhashset Extend the HashSet to allow iteration in the order in which they are inserted
Priorityqueue Extended abstractqueue to support priority-based queuing
TreeSet Implementing groups in a tree, extending abstractset

The most important collection framework in Java

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.