This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

why collection API is called as framework  RSS feed

 
ramesh maredu
Ranch Hand
Posts: 210
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I faced this interesting question in an interview.
We have several packages in java like lang, io etc, but why util package is called as framework (collection framework)?
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's really a question of definition of words, not really a technical Java knowledge question.

One reason I would think of is that the collections interfaces and classes are meant to be extended: they were designed in such a way that you can create your own special collection classes by implementing and extending the interfaces and classes of the Java collections API - in contrast to classes in other packages, which are just meant to be used (and not extended via inheritance).
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Jesper: I agree with you however I hardly ever extend the collection classes. Mainly because almost everything data-structure you would commonly need is already built.
 
Nico Van Brandt
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A framework is a reusable collection of classes and interfaces so pure theoretically it's correct to call it a framework.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16028
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's true Wouter, usually you would just use the standard ArrayList or HashMap, for example, but I guess it's about the principle - the interfaces and classes in the collections API are designed to be extensible, while many of the other standard Java classes are not designed to be extended (in fact, many of them are final, so that you can't extend them).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!