In the Java collection, the rule that determines whether two objects are equal is:1), determine whether the hashcode of two objects are equal.If it is not equal, the two objects are not equal, completeIf equal, transfer to 2)(This is only to improve
On the Internet, I accidentally saw an article about the Common Data Structures in Java, which has been thoroughly analyzed.
:) Linear tables, linked lists, and hash tables are common data structures. During Java Development, JDK has provided a
The set always requires iteration. We do need to check every element in the set, so the set interface inherits the iterable interface without exception, and the unique method of this interface
Iterator
Iterator() Returns an
Java Collection centrally manages Dictionary, Vector, Stack, and Properties.The interfaces supporting the class set are as follows:CollectionListSetSortedSetComparator defines how to compare two objectsObjects in the Iterator enumeration
set OR container usually we use arrays to save some basic data types, arrays are types supported by compilers, but one obvious disadvantage of arrays is that they have fixed sizes, and in general, only when the program is running can we know the
ArrayList and HashMap are asynchronous, while Vector and HashTable are synchronous. Therefore, Vector and HashTable are thread-safe, while ArrayList and HashMap are not thread-safe. Because synchronization takes machine time, the execution
Arraylist and hashmap are asynchronous, while vector and hashtable are synchronous. Therefore, vector and hashtable are thread-safe, while arraylist and hashmap are not thread-safe.Because synchronization takes machine time, the execution efficiency
collections or containers usually we use arrays to hold some basic data types, arrays are types supported by compilers, but one obvious disadvantage of arrays is that they have fixed sizes, and in general, only when the program is running can we
Java Collections FrameworkSet OR containerWe usually use arrays to save some basic data types. arrays are supported by the compiler, but an obvious disadvantage of arrays is that they have fixed sizes. In general, only when the program is running
The Java Collection Framework provides the following two types of containers: 1, Collection (Collection): Access a collection of individual elements. 2. Figure/Map (map): Store key/value pairs (key-value).Collection interface and Abstractcollection
The collection framework is mainly divided into collection classes and mapping classes: The collection class stores a set of pure data, such as a set of objects. The mapping class stores a mapping of key-value pairs, but you can get the key
First, why the need to assemble the frameworkThe length of the array is fixed, but if you are writing a program without knowing how many objects are required when the program is running, or if you need more complex ways to store objects,---you can
This article mainly introduces the framework of the Java collection, so that we have an understanding of the overall framework of the Java collection. The collection interface, the map interface, and the three sub-interface Set,list,queue of the
[Switch] Java, java
A Data Structure is a collection of data in a certain form. It not only stores data, but also supports data access and processing operations. Java provides several data structures that can effectively organize and operate data.
Read Catalogue
Concept and function
Architecture of the collection framework
Introduction to Collection interface and list interface
About Map and HashMap
Collection Tool Class: Collections
Summary
Back to top
Arraylist and hashmap are asynchronous, while vector and hashtable are synchronous. Therefore, vector and hashtable are thread-safe, while arraylist and hashmap are not thread-safe. Because synchronization takes machine time, the execution
Simplified diagram:
The Java platform provides a new collection framework. The set framework consists of a group of interfaces used to operate objects. Different Interfaces describe a set of different data types.
Framework of Java 2 sets
Set
Zookeeper
A container is a series of class instances provided by Java API, used to store objects in programs. A container can manage the lifecycle of an object and the dependency between the object and the object. Java container classes include List,
---restore content starts---A collection can be seen as a container, such as red clothes can be seen as a collection, and all Java classes of books can be seen as a collection. It is easy to store the objects in the collection in the collection, and
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.