Java Collection Framework

Source: Internet
Author: User

The characteristics of a collection

    • interface: is an abstract data type that represents a collection. The interface allows the collection to manipulate the details of its representatives independently. In object-oriented languages, interfaces usually form a hierarchy.
    • implementation (Class): is the specific implementation of the collection interface. Essentially, they are reusable data structures.
    • algorithm: is a useful calculation for the execution of methods in an object that implements a collection interface, for example: Search and sort. These algorithms are called polymorphic, because the same approach can have different implementations on similar interfaces.

Two, set frame diagram

Iii. generic methods

You can write a generic method that can receive different types of arguments when it is called. Depending on the type of argument passed to the generic method, the compiler handles each method call appropriately.

The following is the rule that defines a generic method:

    • All generic method declarations have a type parameter declaration part (delimited by angle brackets) that is part of the type parameter declaration before the method return type (<E> in the following example).
    • Each type parameter declaration section contains one or more type parameters, separated by commas between the parameters. A generic parameter, also known as a type variable, is the identifier used to specify a generic type name.
    • A type parameter can be used to declare a placeholder for the actual parameter type that returns a value type and can be obtained as a generic method.
    • The declaration of a generic method body is the same as other methods. Note that the type parameter can only represent a reference type, not the original type (like Int,double,char, and so on).

Java Collection 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.