Collection of Tool classes collections

Source: Internet
Author: User

Collections is a collection of tool classes that define a number of static methods

BinarySearch (List,object) uses dichotomy to find the element in the collection, returns the subscript of the element in the collection if found, and returns a negative number if it is not found

Copy (list,list) copies all the elements from one collection to another.

Disjoint (collection,collection) two sets if none of the same elements returns true

Min,max (Collection) finds the smallest and largest element in the collection, and the rule is implemented by implementing the CompareTo method in the comparable interface

The reverse (list) reverses the order of the elements in the specified list.

Swap (List,int,int) swaps the elements at the specified list location.

Sort (List) sorts the specified collection, and the rules for sorting are implemented by implementing the CompareTo method in the comparable interface

The rotate (list,int) element is rotated clockwise, and the second parameter is the distance of the rotation

EQ:[A,B,C] rotate1 distance-->[c,a,b]

For comparison of Chinese strings:

The comparison size of the Chinese string is by word comparison, take out each character according to the code to find the corresponding number of characters, and then compare the size of the code number, the empty string is the smallest.


Collection of Tool classes collections

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.