I. Overview of HASHMAPII. data structure of HashMapThird, HashMap source analysis1. Key attributes2. Construction method3. Store data4. Size adjustment5. Data read 6, HashMap performance parametersI. Overview of HASHMAPHashMap the implementation of
1. Counter (counter)Counter is a supplement to the dictionary type that is used to track the number of occurrences of a value.PS: With all the functions of the Dictionary + own functionWe select some of the relatively common methods for example:As
Collection interface:1. The collection can be understood as a dynamic array of objects, but the contents of the objects in the collection can be arbitrarily expanded.This means that the operation in the collection is more convenient, easy to add or
Enhanced for LoopAfter Java 1.5:Used to iterate through collections and arrays (simplifying the operation of iterating through collections and arrays)for (Element_type E:list_array) {}New loops are implemented in the form of iterators do not delete
Java record-52-Java Collection class setThe java. util package contains some of the most exciting enhancements added in java 2: class sets. In addition to the class set, java. util also contains various classes and interfaces that support a wide
Map is used to save data that has mappings, so there are two sets of data stored in the Map collection, a set of keys to hold the map, and a set of keys to hold the value corresponding to the key.The map key does not allow duplication.HashMap and
Java Collection, java Collection class details1. What is a set?
Objects are stored in containers. The object-oriented language represents objects. Therefore, to facilitate operations on multiple objects, you can store objects, A set is the most
Learn the collection classes of Java(1) member variables and initializationPrivate Static Final int Default_capacity = ten; Private Static Final object[] Empty_elementdata = {}; Private transient object[] Elementdata; Private int size;The default
ArrayList inherits from the Abstractlist abstract class and implements the list interface.public class Arraylist extends abstractlist implements List, randomaccess, cloneable, ja Va.io.SerializableAn array of type object is used to store data in the
I. Implementation of Common collection classes
1. ArrayDeque/shortlist: array and linked list of double-end queues
2. HashSet/Map: Hash
3. TreeSet/Map: red/black tree
In fact, TreeSet uses TreeMap internally. When a new element is added, an empty
LinkedListPros: Quick Insert RemovalCons: not suitable for random accessNew Linkedlist(); Staff.add ("Amy"); Staff.add ("Amy"); Staff.add ("Bob"); Staff.add ("Car"); Staff.remove ("Amy"); // even if there are
SetHashSetFeatures: elements are unique, but unordered.How to ensure the uniqueness of the element (analysis source)?with simple analysis, we know that the HashSet collection guarantees that the uniqueness of the element is related to the Add ()
Container (Collection)An array is a container, and a collection is a container.In Java programming, a thing that is loaded with a variety of other objects (reference types), called containers(All the books in the library, in order to manage all
I. Introduction to several important interfaces and classes1. List (ordered, repeatable)List of objects are ordered, but also can be repeated, list is concerned about the index, has a series of index-related methods, query fast. Since inserting or
In Java, the following three classes are often used to process data streams, and the following describes the differences between the three classes and their usage.
InputStream: is a superclass of all byte input streams, generally using its
Several common queues in JavaThe difference between a blocking queue and a normal queue is that when the queue is empty, the operation to get elements from the queue is blocked, or when the queue is full, the operation to add elements to the queue
The implementation classes for the map interface in the Java collection are HashMap, Hashtable, Linkedhashmap, and TreeMap, unlike the list where map is not inherited from the collection interface . You can understand it this way:
Map
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.