Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Collection Framework

Lesson 30 of 39 in the free Java notes on Siksha Sarovar, written by Rohit Jangra.

Collection Framework

The Collection Framework provides a unified architecture for storing and manipulating a group of objects. It is located in the java.util package.

Why Collection?

Arrays are fixed in size and can hold only similar types of data. Collections overcome these limitations:

  1. Growable in Nature: Memory is allocated dynamically at runtime.
  2. Heterogeneous Data: Can store different types of objects (though Generics make them type-safe).
  3. Built-in Methods: Ready-made methods for searching, sorting, insertion, and deletion.

Hierarchy of Collection Framework

The root interface is Iterable, which is extended by Collection.

1. Collection Interface Extended by:

  • List: Main insertion order, allows duplicates.
  • Set: No duplicates, no order guarantee.
  • Queue: FIFO (First In First Out) order.

2. Map Interface Not a child of Collection. Represents Key-Value pairs.

  • Map: Unique Keys, Duplicate Values.

Difference: Array vs Collection

FeatureArrayCollection
SizeFixedDynamic (Growable)
PerformanceFastSlower than array
Data TypePrimitive & ObjectsOnly Objects
MemoryRecommended if size knownRecommended if size unknown