Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collection, Collections and Collections Framework?

 
Pankaja Shinde
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between Collection, Collections and Collections Framework?

What is the role of Maps in them?

Pankaj Shinde
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Sun Java Tutorial has a section on Collections which should answer your questions.
 
Tommaso Nuccio
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Quick overview

"Collection" is an interface where the interfaces Set, List and Queue extend from. These in turn are implemented by the different classes, e.g. the interface Set by HashSet.

"Collections" is a class that holds all kind of static methods. For example Collections.sort(List<T> list) that will sort a list or its overload Collections.sort(List<T> list, Comparator<? super T> c).

"Map"s are also a collection and thus part of the Collection Framework, but "Map" simply does not extend from "Collection".

The Collection Framework is a help for the programmer to make use of well defined, loose coupled and high cohesive classes and interfaces that have been tested to be "perfect".

This should give you a first overview.
Good luck.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic