"Java Summary-collection" Map interface, HASHMAP, etc.

Source: Internet
Author: User

Map interface

Inheritance diagram:

Map Common methods Add, delete operations
    • Object put(Object key, Object value)
    • Object remove(Object key)
    • void putAll(Map m)
    • void clear
Ways to manipulate meta views
    • Set keySet()
    • Collection values()
    • Set entrySet()
Element query operation
    • Object get(Object key)
    • boolean containsKey(Object key)
    • boolean containsValue(Object value)
    • int size()
    • boolean isEmpty()
    • boolean equals(Object obj)
HashMap
    1. HashMap is the most frequently used implementation class for map
    2. Null key and Null value are allowed, and the order of key is not guaranteed as HashSet
Linkedhashmap
    1. Linkedhashmap is a subclass of HashMap
    2. Similar to Linkedhashset to ensure that the traversal order is the same as the insertion Order
TreeMap
    1. Guaranteed key in a certain order
    2. Natural sort
    3. Custom sorting
      Reference treeset;http://blog.csdn.net/ttf1993/article/details/45647775
Hashtable

Old class, Thread-safe

ProPerties

Properties File: Store some settings, or data

new Properties();//实例化一个对象pro.load(new FileInputStream("jdbc.properties"));//加载属性文件String user = pro.getProperty("user");//得到属性值

"Java Summary-collection" Map interface, HASHMAP, etc.

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.