Java Container's Map interface

Source: Internet
Author: User

Map Interface:

1. The class that implements the Map interface is used to store key-value (key-value) pairs;

2. Map interface implementation class has HASHMAP and TREEMAP, etc.;

3. Key-value pairs stored in the Map class are identified by key, so the key value cannot be duplicated.

4. The common methods of MAP interface are as follows:

4.1 Object put(K key, V value): Associates the specified value with the specified key in this map (optional operation);

4.2 Object Get(Object key): Returns the value mapped by the specified key;

4.3 Object Remove(Object key): If there is a mapping relationship for a key, it is removed from this mapping (optional operation);

4.4 Boolean containskey(Object key): Returns TRUE if this map contains a mapping relationship for the specified key ;

4.5 Boolean containsvalue(Object value): Returns TRUE if the map maps one or more keys to the specified value ;

4.6 int size(): Returns the key-value logarithm in this map;

4.7 int hashcode(): Returns the hash code value for this mapping;

4.8 void Putall(map<?,? >): Copies all mappings from the specified mappings into this map (optional operation).

Java Container's Map interface

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.