Close on January 4

Source: Internet
Author: User

1. Two Methods of hashmap traversal in Java

The following two methods are recommended:

Iterator iter = hmap. entryset (). iterator ();

Map. Entry entry = (Map. Entry) ITER. Next ();

(INT) entry. getkey ();

(INT) entry. getvalue ();


2.How to Use priorityqueue priority queue in Java


3.Java/C ++ bit operations


Bit operations can only be used for integer data

The arithmetic shift is the same as the logical shift in the left shift. All values are filled with 0. The right shift arithmetic shift is based on the symbol bit, and the logic is shifted to the right or directly supplemented with 0.

Tips for common bit operationsHttp://

Judge parity,Exchange two numbers, Exchange symbol, calculate absolute value

4. Find the k-th-largest Value Method



1) first sort and then take

2) maintain a K-sized heap

3) draw on the idea of fast sorting, and partition cyclically until the flag node is K

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: 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.