In Java, "Collection" refers to the interface that defines the basic properties and behaviors of a collection, while "Collections" is a utility class that provides static methods for working with collections.
The Collection interface is part of the Java Collections Framework and it is a root interface for all the collections. It defines the basic properties and behaviors that all collections should have, such as adding and removing elements, checking the size of the collection, and so on.
It includes List, Set and Queue interfaces.
On the other hand, the Collections class is a utility class that provides various static methods for working with collections, such as sorting, reversing, and searching. It also provides methods for creating unmodifiable collections, which are collections that cannot be modified after they are created.
Here are some examples of how we can use the Collections class:
To sort a List:
List<Integer> myList = new ArrayList<>();
myList.add(3);
myList.add(1);
myList.add(2);
Collections.sort(myList);
To reverse an array:
Collections.reverse(myList);
To create an unmodifiable collection:
List<Integer> unmodifiableList = Collections.unmodifiableList(myList);
It's worth noting that, the Collections class only provides static methods, it does not provide any instance methods. So, you can't create an object of the Collections class.