Arraylist and rule list

Source: Internet
Author: User

The method is not flexible when you look at the document.

When a loop is added, the time complexity is high.

Collection is a collection. collections is a tool class that provides many methods to operate collections.

The basic data types can be directly sorted. Arrays vertex sort method.

We have finished the arraylist method. If you are not familiar with it, you should exercise well.

Perform operations on objects:

Array list. Person @ f39b3a: storage address.

For each is limited to list sets and can be stored continuously only in some storage methods.

For (person P: list): which set of loops is followed by the colon, and what is obtained by each loop before the colon.

An iterator is a design pattern. The list contains a method called iterator that returns an iterator type.

Iteration loop and for each loop must be mastered.

Click has next to determine whether there is a next digit.

Anonymous internal class: Why do you need to use an anonymous internal class:

The interface and abstract class cannot be new.

The compare to method converts characters to unicode encoding, so it is of the int type.

Form your own way of thinking.

Be careful when programming.

What are the linked list methods: linked list,

No way to build a house without laying the foundation.

Be familiar with methods.

Aray list
Arraylist encapsulates an array object []. When an arraylist is instantiated, an array is also instantiated. when an object is added to the arraylist, the array size also changes accordingly. This will bring about the following Disadvantages:
You can access each element immediately without considering performance issues. You can call the get (I) method to access array elements whose subscript is I.
Slow object adding speed when you create an array, you cannot determine its capacity. Therefore, when you change this array, you must do a lot in the memory.
Slow operation of objects. When you want to add an object between any two elements in the array, the array needs to move all the objects following it.

Shortlist
The vertex list is implemented by directly connecting nodes to each other. Each node contains the reference of the previous node, the reference of the next node, and the value stored by the node. When a new node is inserted, you only need to modify the reference of the node in which the relationship is maintained. This is also true when deleting the record. This will bring about the following Disadvantages:
To perform operations on objects, you only need to change the connection speed. New nodes can be anywhere in the memory.
You cannot access the get () method immediately. However, this method is slow because it is located by traversing the contacts.

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.