I encountered this problem when I went to a company for an interview a few days ago. The difference between collection and collections in Java was not at that time. I came back and found it online. Now I want to record it. 1. java. util. collection is
Set Interface . It provides common interface methods for basic operations on collection objects. The collection interface has many specific implementations in the Java class library. The collection interface provides a unified operation mode to maximize various specific sets.
Collection
Shortlist
│ Invalid parameter list
│ ├ Arraylist
│ Vector
│ Elastic Stack
Sorted set
2. java. util. collections is a packaging class. It contains various Set Operations static polymorphism . cannot be instantiated , like a Tools Class , 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 list is the list that implements the collection interface = 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);} // result: 23.0 111.0 112.0 231.0 456.0 }}