java-Collection Class (i)

Source: Internet
Author: User
Tags comparable

Concept Understanding 1. Collection Class

The collection class is used to store dynamically changing data sets, which can only store a fixed number of datasets, and the collection class is more flexible.

2. Introduction to each collection class


(1) interface
Iterable: Implements the Set traversal function, which is implemented for each collection class and supports the foreach
Collection: Basic set interface, support adding and removing functions, including List, Set, Queue interface.
List: Repeatable data collection, indexed for easy deletion and modification.
Set: A collection of data that cannot be duplicated.
Queue: A doubly linked list that supports tail-to-back operations.

(2) List implementation class
ArrayList: The most common list collection, based on the array implementation, the array can dynamically grow automatic expansion.
Linklist: Based on linked list implementation, it is more efficient to traverse and insert Delete special location.
vector:jdk1.2 API, deprecated, supports thread-safe, non-thread-safe can be replaced with ArrayList.
Stack: Inherits vectors to implement last-in-first-out stacking functionality.

(3) Set implementation class
HashSet: Based on the HASHMAP implementation, the key value of the HashMap is saved set for non-repeatability.
Linkhashset: Based on the Linkedhashset implementation, the list-type HashSet.
TreeSet: Set with sort function, internal use of TREEMAP.
Enumset: The set collection of enum types.

(4) Queue implementation class
Priorityqueue: Sort Queue, can add comparable parameter or let element implement comparable interface, realize automatic sorting function.

(5) MAP implementation class
HASHMAP: Array linked list structure, according to hash lookup corresponding storage array bit, the same array bit by the chain list structure, key-value form of storage data, key can not be the same, the same condition is key equal and hashcode are the same.
TreeMap: A Map of key sort, inside a red-black tree structure, to avoid the worst search results.
Weakhashmap:key is stored in weakreference form, and does not strongly reference key to optimize memory.
HashTable: Old API, less used, thread-safe map, subclass has Properties property file Operation class.

(6) collections, arrays class
A tool class for a collection class that provides a series of static methods for sorting, searching, and Cheng of elements in a collection.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

java-Collection Class (i)

Related Article

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.