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)