티스토리 뷰



Collection - Interface

Collection is a base interface of the Java Collection Framework for List, Set and Queue.














Collections - class

Collections is a class in java.util package and it is utility class for Collection.

Collections class has methods for Sorting, Searching etc


Example

Collections.addAll(A,B); 

Collections.addAll method takes all of the elements of 'B' and fetch the elements to the collection 'A'


Collections.sort(A); 

Collections.sort method sorts the element of specified list 'A' in ascending order.



Reference

https://www.quora.com/What-are-the-main-differences-between-Collection-and-Collections-in-Java

https://www.geeksforgeeks.org/collections-sort-java-examples/

'JAVA' 카테고리의 다른 글

Object type casting(upcasting,downcasting) example in Java  (0) 2019.06.17
StringBuffer in Java  (0) 2019.03.05
How to convert Arrays to List  (0) 2019.02.26
Lambda Expression in Java  (0) 2019.02.22
compareTo method in Java  (0) 2019.02.21