What are the basic interfaces of the Java Collection Class framework?

Source: Internet
Author: User

There are a total of two interfaces: Collection and Map, a collection of elements, and a set of key-value pairs, where the list and set interfaces inherit the Collection interface, one is an ordered set of elements, and the other is a set of unordered elements, while ArrayList and LinkedList The implementation of the list interface, HashSet implementation of the set interface, which are more commonly used, HASHMAP and hashtable implementation of the map interface, and Hashtable is thread-safe, but HashMap performance is better;

Note: All collections (List, set, and map) implement Cloneable (prototype mode) and Serializable (serialization)

java.util.Collection [I]

|-java.util.list [I]

|-java.util.arraylist [C]

|-java.util.linkedlist [C]

|-java.util.vector [C]

|-JAVA.UTIL.STACK[C]

|-java.util.set [I]

|-java.util.hashset [C]

|-java.util.sortedset [I]

|-java.util.treeset [C]

Java.util.Map [I]

|-java.util.sortedmap [I]

|-java.util.treemap [C]

|-java.util.hashtable [C]

|-java.util.hashmap [C]

|-java.util.linkedhashmap [C]

|-java.util.weakhashmap [C]

The most basic interfaces in the Java Collection class are:

Collection: Root interface for single-column collections

List: Elements are ordered and repeatable

ArrayList: Similar to a variable-length array. Suitable for inquiries, not suitable additions and deletions

LinkedList: The bottom is a two-way loop linked list. Suitable for additions and deletions, not suitable for inquiries.

Set: Element unordered, non-repeatable

HashSet: Determines the position of an element in the collection based on the hash value of the object

TreeSet: Storing elements in a two-tree way, enabling ordering of elements in the collection

Map: The root interface of a double-column collection that stores elements that have a key (key), value-mapping relationship.

HashMap: Used to store a key-value mapping relationship, cannot appear duplicate key

TreeMap: Used to store key-value mappings, cannot appear duplicate key key, all keys are arranged in binary tree way

What are the basic interfaces of the Java Collection Class framework?

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.