1. Java Collection
(1), the difference between several sets (List, set, and map)
differences between several collections in Java (list, set, and map)
Summary of common Java collections
(2), set of common traversal mode
is to take all the elements of the collection out of this, there are three ways:
For example, list list = new ArrayList ();
List.add ...
1. For ArrayList, the speed is faster, with a for loop, with size as a conditional traversal:
int size = List.size ();
for (int i = 0; i < size; I + +) {
List.get (i);
}
2. The general traversal of the collection class, from an earlier version, iterates with iterators:
Iterator it = List.iterator ();
while (It.hasnext ()) {
Object obj = It.next ();
}
3. JDK has a newer version of the method, but I do not quite understand its principle, and JS in the traversal is very similar:
for (Object obj:list) {
Obj is an element that is taken out once.
}
Original address:
what does the traversal collection of Java mean? Reference article: Several circular accesses to the list of collection objects in Java Summary of Java face questions (3) Sorting issues Analysis and Java implementation of various sorting algorithms for 3 kinds of common sorting methods
Java Fundamentals Review