Collection learning notes and collection learning notes

Source: Internet
Author: User

Collection learning notes and collection learning notes

 

BinarySearch principle:

 

Public static index halfSearch (List <String> list, String key)

{

 

Int max, min, mid;

Max = list. size ()-1;

Min = 0;

While (min <= max)

{

Mid = (max + min)> 1;

String str = list. get (mid );

Int num = str. compareTo (key );

If (num> 0)

Max = mid-1;

Else if (num <0)

Min = min + 1;

Return min; // if it is Collections. binarySearch (), it is the location after min-(Access Point)-1

}

}

--------------------

Collections. fill (list, "pp ");

Replace all elements in the set with pp

--------------------

Collections. replaceAll (list, "oldValue", "newValue ");

Same:

List. set (index, "newValue ");

----------------------

Collections. reverse (list );

----------------------

Collections. swap (list, 1, 2); // badge 1, badge 2 swap

----------------------

Collections. shuffle (list); // random list

----------------------


What kind of software is good for taking study notes?

Both the Mind Map and Wiz are good. Wiz is suitable for web-based Mind Map, which requires a certain degree of knowledge. However, you will find it extremely useful.
 
Type of collection

Root Interface in Collection hierarchy
Collection represents a group of objects, also known as collection elements.
All common Collection implementation classes (usually indirectly implement Collection through a sub-interface) should provide two "standard" constructor Methods: one is void (No parameter) constructor, creates an empty collection. The other is a constructor with a Collection type single parameter. It is used to create a collection with the same elements as its parameters.

Related Article

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.