Summary of Java Collections

Source: Internet
Author: User

A graph represents the approximate structure of a Java collection:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7F/1A/wKiom1cTjSzS1BbuAAE4uBxAcqM141.png "title=" 1111. PNG "alt=" Wkiom1ctjszs1bbuaae4ubxacqm141.png "/>

Collection interface-Defines the method of accessing the object, and its sub-interface set and list define the storage mode separately.

data Objects in set are not sequential and cannot be duplicated

The data objects in the list are in order and can be repeated

PS: The container must hold the object of the reference type, because the reference object is in the heap, will not be recycled by the GC at any time, sometimes we see the Add (2) Such code, is the JVM automatically help us to convert the int type to an integer type

The map interface defines a method for storing the key (key)-Value mapping pair


It is important to note that container class objects need to compare objects for equality when calling methods such as Remove,contains, which involves the Equals method and the Hashcode method of the object type, for custom types, You need to override the Equals and Hashcode methods to implement custom object equality rules, and equal objects should have equal hashcode, understanding "= =" and "Equals ()" Hashcode () methods

This article is from the "Henrysun" blog, make sure to keep this source http://henrysun1993.blog.51cto.com/6315762/1765186

Summary of Java Collections

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.