Java Container (collection)

Source: Internet
Author: User

I. Basic CONCEPTS

1. What is a container?

2. Why do I need a container?

3. Classification of containers?

Two. Key knowledge

List interface

Collections Class

(1) Why do I need it?

Collection class implementation class, and there is no sort, inversion, lookup method, these methods can be given by collections, and the method of the class is public static, can be called directly with the class name

(2) What are the methods?

Comparable interface

(1) Why is there a comparable interface?

The comparison method of the container, such as a custom class, is not, so you can implement the comparable interface to achieve the comparison of the individual collections (note that the comparison criteria for the basic type and the data of the string class are available)

(2) How to instance comparable interface?
The ToString () method and the CompareTo () method need to be overridden, and the CompareTo () method is called automatically at sort time

Set interface

What classes need to override the Equals () method and the Hashcode () method?

Java Container (collection)

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.