Java Learning Note (2)----hash set/linear table/Queue/Collection/graph (SET,LIST,QUEUE,COLLECTION,MAP)

Source: Internet
Author: User

1. All instance classes in the Java Collection Framework implement the cloneable and Seriablizable interfaces. As a result, their instances are replicable and serializable.

2. The rule set stores the elements that are not duplicates. To store duplicate elements in a collection, you need to use a linear table. A linear table can not only store duplicate elements, but also allow the user to specify the location of the storage. The user can access the elements in the linear table by subscript.

3. The Java collection supports three types of rule sets: Hash set HashSet, chained hash set linkedhashset, and tree set TreeSet. HashSet stores elements in an unpredictable order; Linkedhashset stores elements in the order in which they are inserted; TreeSet stores already sequenced elements. All methods in HashSet, Linkedhashset, and TreeSet inherit from the collection interface.

4. The Java Collection Framework supports two types of linear tables: array linear table ArrayList and linked list LinkedList. ArrayList is a variable-size array that implements the list interface. All methods in ArrayList are defined in the list interface. LinkedList is a linked list that implements the list interface. In addition to implementing the list interface, this class provides a way to extract, insert, and delete elements from both ends of a linear table.

5. The vector class implements the list interface. In Java 2, the vector class and the ArrayList are the same, and the difference is that the method that it contains to access and modify the vectors is synchronous. The stack class extends the vector class and provides several ways to manipulate the stack.

6. The queue interface represents queues. The Priorityqueue class implements the queue interface for the priority queue.

7. The collection interface represents a collection of elements stored in a rule set or linear table. The map interface maps the key values to the elements, and the key values are similar to the subscripts. In list, the subscript is an integer. In the map, the key value can make any type of object. The figure cannot contain duplicate key values. A key value can correspond to one value at most. The map interface provides a way to query, update, get a collection of values, and a collection of key values.

8. The Java Collection Framework supports three types of graphs: Hash chart: HASHMAP, Chain Hash chart: Linkedhashmap and tree Chart treemap. HashMap is efficient for locating a value, inserting a map, and deleting a map. Linkedhashmap supports the ordering of entries in the diagram. The entries in the HashMap class are not sequential, but the entries in the Linkedhashmap can be obtained in some order, either in the order in which they are inserted into the diagram (in order of insertion) or in the order they were last accessed, from the earliest to the latest (called The Access Order). TreeMap is efficient for traversing the ordered key values. The key values can be sorted using the comparable interface, or they can be sorted using the comparator interface.

Java Learning Note (2)----hash set/linear table/Queue/Collection/graph (SET,LIST,QUEUE,COLLECTION,MAP)

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.