2. TOPICS
• What Is Collection??
• What Is Framework??
• What Is Meant By Collection Framework??
• What Is The Need Of It??
• Hierarchy Of Collection Framework
• Example Program??
• Advantages & Disadvantages
3. COLLECTION
• A Collection Represents A Single Unit Of Objects, I E., A Group.
• The Collection In Java Is A Framework That Provides An Architecture To Store And Manipulate The Group
Of Objects.
• All The Operations That You Perform On A Data Such As Searching, Sorting, Insertion, Manipulation,
Deletion, Etc. Can Be Achieved By Java Collections.
• Java Collection Means A Single Unit Of Objects. Java Collection Framework Provides Many Interfaces (Set,
List, Queue, Deque, Etc.) And Classes (Array List, Vector, Linkedlist, Priority Queue, Hashset, Linked
Hashset, Tree Set, Etc.).
5. WHAT IS COLLECTION FRAMEWORK
•The Collection Framework Represents A Unified Architecture For Storing And
Manipulating A Group Of Objects. It Has:
•Interfaces And Its Implementations, I.E., Classes
•Algorithm
6. NEED OF COLLECTION FRAMEWORK
• All The Data Operations(sorting/Adding/Deleting) Are Possible With Arrays
And Moreover Array Is Suitable For Memory Consumption And Performance
Is Also Better Compared With Collections.
7. HIERARCHY OF COLLECTION FRAMEWORK
•Let Us See The Hierarchy Of Collection Framework In The Next Slide &
The Java .Util Package Contains All The Classes And Interfaces For
Collection Framework.
8.
9. COLLECTION BY EXAMPLE - ARRAY LIST
Import Java.Util.List;
Import Java.Util.Arraylist;
Import Java.Util.Iterator;
Public Class Arraylistprejdk15test
{
Public Static Void Main(string[] Args)
{
List Lst = New Arraylist();
Lst.Add("alpha");
Lst.Add("beta");
Lst.Add("charlie");
System.Out.Println(lst);
Iterator Iter = Lst.Iterator();
While (Iter.Hasnext())
{
String Str = (String)iter.Next();
System.Out.Println(str);
}
}
}
11. ADVANTAGES OF COLLECTIONS
FRAMEWORK:
We need not to learn multiple ad hoc collection apis.
It provides a standard interface for collections that fosters software reuse and
also provides algorithms to manipulate them.
Reduces the effort required to design and implement apis by eliminating the
need to produce ad hoc collections apis.
12. It provides useful data structures and algorithms that reduces programming effort due to which we
need not to write them ourselves.
It provides high-performance implementations of useful data structures and algorithms that
increases the performance.
Helps in establishing a common language to pass collections back and forth that provides
interoperability between unrelated apis.
Collection is resizable and can grow.