public static <t extends Comparable<? Super t>> void Sort (list<t> List) understanding

Source: Internet
Author: User
Tags comparable

public static <t extends Comparable<? Super t>> void Sort (list<T> list) understanding

public static <t extends Comparable<? Super t>> void sort (List <t> list)

(1) First: public static void Sort (List list)

(2) for security and generics: public static <T>void sort (List <T> list)

(3) to sort first compare, to have comparability, so t must be a subclass of comparable: public static <t extends comparable >void sort (List <T> list)

(4) Comparable interface also has a generic type: public static <t extends comparable <T> > void Sort (List <T> List

(5) t The parent class is also OK, <? Super t> indicates that the type lower bound in comparable<> is t:public static <t extends Comparable<? Super t>> void sort (List <t> list)

public static <t extends Comparable<? super t>> void Sort (list<t> List) Understanding

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.