Java Fundamentals Review

Source: Internet
Author: User

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.