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