top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the difference between Collection and Collections in java?

0 votes
503 views
What is the difference between Collection and Collections in java?
posted Feb 5, 2018 by Ammy Jack

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

Collection is an interface whereas Collections is a class. Collection interface provides normal functionality of data structure to List, Set and Queue. But, Collections class is to sort and synchronize collection elements.

answer Feb 9, 2018 by Frank Lee
0 votes

Collections is merely an utility method class for doing certain operations, for example adding thread safety to your ArrayList instance by doing this.

List<Object> list = Collections.synchronizedList(new Arraylist<Object>());

The main difference in my opinion is that Collection is base interface which you may use in your code as a type for object while Collections just provides useful operations for handling the collections.

answer Mar 2, 2018 by Madu Hansi
...