A linked list is an ordered collection that stores each object in a separate node, and each node holds a reference to the next node. In Java, because a linked list is a two-way link, each node also holds a reference to the previous node.(Image from Java Core Technology Volume 1 Basics)To delete an element in the middle
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 of Vector and HashTable is lower than that of ArrayList and HashMap. Collection sorted List interface │ ordered List linked
The class hierarchy is as follows:Collection objectsShortlist│ Invalid parameter list│ ├ ArrayList│ Vector│ Elastic StackSorted SetMap├ Hashtable├ HashMap└ WeakHashMap
Next we will introduceCollection InterfaceCollection is the most basic Collection interface. A Collection represents a group of objects, namely, Elements of the Collection ). Some collections allow the same elements while others do not. Some can be sorted, while others cannot. The
interface
The Randomaccess interface is a flag interface and does not provide any methods in itself, and any object that implements the Randomaccess interface can be considered an object that supports fast random access. The primary purpose of this interface is to identify those list implementations that can support fast random access .
In the JDK, any array-based list implementation implements the Randoma
and collection have identical interfaces.3, List, you can use the Get () method to remove one element at a time. Use numbers to select one of a bunch of objects, get (0) .... (Add/get)4, generally use ArrayList. Use LinkedList to construct stack stacks, queue queues.5, map with put (K,V)/get (k), you can also use ContainsKey ()/containsvalue () to check if it contains a key/value.HashMap will use the object's hashcode to quickly find the key.6, the e
Linear table, linked list, hash table is a common data structure, in Java development, the JDK has provided us with a series of corresponding classes to implement the basic data structure. These classes are all in the Java.util package. This article attempts to explain to the reader the functions of each class and how to use them correctly through a simple description.Collection├
Transferred from: http://www.jb51.net/article/45660.htmThe principle of a variable group in Java is to constantly create new arrays, adding the original array to the new array, and following the Java list usage in detail.List: The elements are ordered (how to take out, the order will not be chaotic), the elements can be repeated (the angle of 1 on the 3, the angl
American programmer Jon Scott Stevens unveiled a list of development tools used by his startup company.His language platform is Java and the development project is a Web site (not yet online). The tools used are open source and available for free.Among the current entrepreneurs, there seems to be few people using Java as a web developer language. This is certainl
Recently asked about the list, is a friend and I discussed Java when said. To tell the truth, I learn programming in nearly a year, the things I learned are quite few. Language is learning Java and C #, a little html+css+javascript about the web. Because the comparison preference, the study WinForm is more earnest, the database operation also has the research one
See Black Horse Video 4th day database operation in,listReally do not understand, looked up the Java textbook, the results did not mention. The original list is a system interface.Original Posts http://cq520.iteye.com/blog/1826788As you know, the set framework is a unified standard architecture for representing and manipulating collections, and learning the set of knowledge helps us to solve a series of pro
. The greatest feature of the vector class is thread safety, which is uncommon throughout the set framework. It is because of thread safety that execution is inefficient and is now almost obsolete. Even though it is not used in multithreaded programming, it is replaced with a ArrayList lock. The inside of the vector is an array structure and is extensible, with a step size of 100%. Vector additions and deletions are very slow.6.2ArrayList class.The ArrayList class is intended to replace the vect
Java container Class Analysis: Collection, List, ArrayList,1. Iterable and Iterator
Iterable is an interface that enables the collection object to traverse its own elements through the iterator.
Public interface Iterable
Modifier and Return Value
Method Name
Description
Iterator
Iterator()
Returns an iterator whose internal elements are T type.
Default void
ForEac
Linear table, linked list, hash table is a common data structure, in Java development, the JDK has provided us with a series of corresponding classes to implement the basic data structure. These classes are all in the Java.util package. This article attempts to explain to the reader the functions of each class and how to use them correctly through a simple description.Collection├
same attributes (such as int i), there is the same method (such as void f ()),The A.I is called the I in the listA.F () is called the F () in ArrayList;---------------------------------------------------------------The key to the problem:Why use list List = new ArrayList () instead of ArrayList alist = new ArrayList ()?The problem is that the list has more than
Java list Interface Usage and javalist Interface Usage
List is an interface that inherits from the collection interface. The type of values stored in list is declared by list
Package test_list; import java. util. arrayList; impo
Java implements two-way linked list
Two-way linked list:
There is a bidirectional pointer, that is, a bidirectional Chain Domain.
Link node structure:
┌ ── ─ ┬ ── ─ ┐
│ Data │ next │ previous │
└ ── ─ ┴ ── ─ ┘
A two-way linked list does not need to be a double-ended linked list
the sequence. Iterators are often referred to as "lightweight" objects because they are less expensive to create.The iterator functionality in Java is relatively simple and can only be moved one way:(1) Use method iterator () requires the container to return a iterator. The first time you call Iterator's next () method, it returns the first element of a sequence.(2) Use Next () to get the next element in the sequence.(3) Use Hasnext () to check if th
the sequence. Iterators are often referred to as "lightweight" objects because they are less expensive to create.The iterator functionality in Java is relatively simple and can only be moved one way:(1) Use method iterator () requires the container to return a iterator. The first time you call Iterator's next () method, it returns the first element of a sequence.(2) Use Next () to get the next element in the sequence.(3) Use Hasnext () to check if th
The linked list is a kind of complex data structure, and the relationship between the data makes the list divided into three kinds: single linked list, circular chain list, bidirectional linked list , and the following will be introduced. Linked
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.