1, Java.util.Collection is a
Collection Interface。 It provides a common interface method for basic operations on a collection object. The collection interface has many specific implementations in the Java class Library. The significance of the collection interface is to provide a maximum unified operation for a variety of specific sets. Collection
├list
│├linkedlist
│├arraylist
│└vector
│└stack
└set 2, Java.util.Collections is a packing class. It contains a variety of information about the collection operation.
static Polymorphic method, which can be used to search, sort, and thread security of various sets. This class
cannot be instantiated, just like a
a tool class, and serves the collection framework of Java.
Import java.util.ArrayList;
Import java.util.Collections;
Import java.util.List;
public class Testcollections {
public static void Main (String args[]) {
Note that the list is implemented with the collection interface
List List = new ArrayList ();
Double array[] = {112, 111, 23, 456, 231};
for (int i = 0; i < Array.Length; i++) {
List.add (New Double (Array[i]));
}
Collections.sort (list);
for (int i = 0; i < Array.Length; i++) {
System.out.println (List.get (i));
}
Results: 23.0 111.0 112.0 231.0 456.0
}
}