Older Dick Silk Self-study note--java 0 basics to rookie--030

Source: Internet
Author: User

Map,hashmap,linkedhashmap,treemap,collections Class (Non-collenction interface)

1. Map

Map Overview: An object that maps keys to values. A map cannot contain duplicate keys, and each key can be mapped to at most one value. This is the key-value pair.

The difference between map and collection: Map: The element that stores the key-value pair, the keyboard is unique, and the value can be duplicated.

Collection: Stores individual elements, sub-interfaces set elements unique, sub-interfaces list elements can be duplicated.

Format:< key type, value type, such as:map<string,string> mp=new hashmap<string,string> ();

Put ();

Remove ();

Clear ();

EntrySet ();

Get ();

KeySet ();

Values ();

ContainsKey ();

Containsvalue ();

IsEmpty ();

Size ();

2, HashMap

The key is the hash table structure that guarantees the uniqueness of the key.

The difference between HashMap and Hashtable: HashMap: Thread insecure, high efficiency, allow null key, value.

Hashtable: Thread-safe, inefficient, null key, value not allowed.

3, Linkedhashmap

The hash table and link list implementations of the map interface have a predictable sequence of iterations.

4, TreeMap

The key is a red-black tree structure that guarantees the ordering and uniqueness of the keys.

5. Collections Class (Non-collenction interface)

The difference between collections and collection: Collections: A tool class for collection operations.

Collection: The top-level interface of the collection, with the list and set subinterfaces.

Sort ();

Binartsearch ();

Max ();

Min ();

Reverse ();

Shuffle ();

Older Dick Silk Self-study note--java 0 basics to rookie--030

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.