The difference between collection and collections in Java

Source: Internet
Author: User

1, Java.util.Collection is aCollection Interface。 It provides a common interface method for basic manipulation of collection objects. The collection interface has many specific implementations in the Java class Library. The meaning of the collection interface is to provide a maximum unified operation for a variety of specific collections. Collection
├list
│├linkedlist
│├arraylist
│└vector
│└stack
└set 2, Java.util.Collections is a wrapper class. It contains a variety of information about collection operations.static Polymorphic method。 This classcannot instantiate, just like aa tool class, serving the Java Collection framework.
Importjava.util.ArrayList; Importjava.util.Collections; Importjava.util.List;  Public classtestcollections { Public Static voidMain (String args[]) {//Note that list is the implementation of the collection interfaceList List =NewArrayList (); DoubleArray[] = {112, 111, 23, 456, 231 };  for(inti = 0; i < Array.Length; i++) {List.add (NewDouble (Array[i]));          } collections.sort (list);  for(inti = 0; i < Array.Length; i++) {System.out.println (List.get (i)); }          //results: 111 231 456    }  } 

The difference between collection and collections in Java

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.