ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

What is the difference between collections and collection in java?

user-image
تم إضافة السؤال من قبل Ajith Fernandez , Software Engineer , Nayasoft Solutions Pvt.ltd
تاريخ النشر: 2013/11/28
Thiyagu Paulraj
من قبل Thiyagu Paulraj , Associate Software Engineer , Multiinnovate Technologies Pvt Ltd

Collection, as its javadoc says is "The root interface in the collection hierarchy." This means that every single class implementing Collection in any form is part of the Java Collections Framework.

The Collections Framework is Java's native implementation of data structure classes (with implementation specific properties) which represent a group of objects which are somehow related to each other and thus can be called a collection.

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

List<MyObj> list =Collections.synchronizedList(newArraylist<MyObj>());

The main difference in my opinion is that Collection is base interface which you may use in your code as a type for object (although I wouldn't directly recommend that) while Collections just provides useful operations for handling the collections.

 

 

For more detail have a look on this documentation, 

For Collections - http://docs.oracle.com/javase/6/docs/api/java/util/Collections.html

For collection in Java - http://docs.oracle.com/javase/6/docs/api/java/util/Collection.html

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟