Java Collection Classifications

Source: Internet
Author: User

Java Collection Categories:
  • List
  • Set
  • Map
  • Queue
  • Array
  • Tool class
  • Extension classes

List:

  • ArrayList: Dynamic Array.
  • LinkedList: Doubly linked list.
  • Vector: Dynamic array of thread safety.
  • Stack: The object stack, followed by the advanced post-out principle.

Set:

  • Enumset: Enum type private set, all elements are enumerated types.
  • HashSet: Set that determines the position of an element as a hash code
  • TreeSet: Set that is automatically sorted when inserted, but if the element size is modified halfway, it will not be re-ordered and will only be sorted at insert time.

MAP:

  • TreeMap: Automatically sort map, automatically sorted by key value.
  • Hashmap:entry Array, the hash code of key determines the position of the element, so, to ensure that the key hash code is inconsistent, if the value is different but hash code of the same key, will be the one-way list extension
  • HashTable: Thread-safe
  • A subclass of properties:hashtable that loads data from the property file and provides easy read and write operations.
  • Enummap:key must be an enumeration type.

Queue:

  • Blocking queues, which are filled with subsequent insertion of elements, throw an exception;
    • Arrayblockingqueue: implemented in array mode.
    • Priorityblockingqueue: The queue according to the priority component.
    • Linkedblockingqueue: Implemented through a linked list.
  • Non-blocking queues, without boundaries, can continue to be appended as long as memory is allowed.
    • Priorityqueue
  • Double-ended queue, which supports inserting and removing elements at both ends. While the upper blocking queue and non-blocking queue are both single-ended queues, they can only be inserted at one end and deleted at the other end.
    • Arraydeque
    • Linkedblockingdeque
    • LinkedList

Tool class:

  • Array tool Classes
    • Java.util.Arrays
    • Java.lang.reflect.Array
  • Collection Tool Class
    • Java.util.Collections

Extension classes:
You can write a list yourself, or use a third-party implementation such as:

  • Apache's Commons-collections expansion pack
  • Google's google-collections expansion pack

Java Collection Classifications

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.