SlideShare a Scribd company logo
Collection Framework - I 
consists of THREE parts 
• interfaces, the abstract data types that the 
framework supports. 
• implementations, the concrete versions of 
these interfaces. 
• algorithms, the predefined actions that can be 
defined on either the interfaces or their 
implementations. 
1
Collection Framework - I 
• All implementations are unsynchronized. 
• All implementations are serializable and 
cloneable. 
• All implementations support having null 
elements. 
2
Collection Framework - I 
• The predefined algorithms for supporting the 
framework are found in the Collections and 
Arrays classes. 
3
Collection Framework - I 
• Framework - Four core interfaces 
• Two specializations for sorting 
1. Collection 
2. List 
3. Set 
4. Map 
5. SortedSet 
6. SortedMap 
4
Collection Framework - I 
Interface type and its implementation 
5 
Interface Implemented 
Set HashSet, LinkedHashSet, EnumSet 
SortedSet TreeSet 
List Vector, Stack, ArrayList, LinkedList 
Queue PriorityQueue, LinkedList 
Map 
Hashtable, HashMap, LinkedHashMap, 
WeakHashMap, IdentityHashMap 
SortedMap TreeMap
Collection Framework - I 
Conversion of different Collection data types 
• Implementations of the Collection interface 
normally have a constructor that accepts a 
Collection object. 
• This enables you to convert a Collection to a 
different type of Collection, such as a Queue 
to a List, or a List to a Set, etc. 
6
Collection Framework - I 
Conversion of different Collection data types 
constructors of some implementations 
• public ArrayList (Collection c) 
• public HashSet (Collection c) 
• public LinkedList (Collection c) 
7
Collection Framework - I 
An example that converts a Queue to a List 
import java.util.*; 
public class MainClass { 
public static void main(String[] args) { 
Queue queue = new LinkedList(); 
queue.add("Hello"); 
queue.add("World"); 
List list = new ArrayList(queue); 
System.out.println(list); 
} // output :: [Hello, World] 
} 8
Collection Framework - I 
This example converts a List to a Set. 
import java.util.*; 
public class MainClass { 
public static void main(String[] args) { 
List myList = new ArrayList(); 
myList.add("Hello"); 
myList.add("World"); 
myList.add("World"); 
Set set = new HashSet(myList); 
System.out.println(set); 
} 
} 
9

More Related Content

PPTX
Java collections
ODP
Java - Collections
PPT
java collections
PPTX
C# Non generics collection
PPT
Collections in Java
PPTX
Java ArrayList Video Tutorial
PDF
Collections In Java
Java collections
Java - Collections
java collections
C# Non generics collection
Collections in Java
Java ArrayList Video Tutorial
Collections In Java

What's hot (13)

PPT
JAVA Collections frame work ppt
PPT
Java collection
PDF
07 java collection
PPT
Collections
PDF
Collections Api - Java
PPTX
Mule data weave_4
DOCX
Stacks in data structure
PPT
Collections
PPT
System settings api
PPTX
Mule data weave_8
PPTX
Collections and its types in C# (with examples)
PPTX
Assignment 2
JAVA Collections frame work ppt
Java collection
07 java collection
Collections
Collections Api - Java
Mule data weave_4
Stacks in data structure
Collections
System settings api
Mule data weave_8
Collections and its types in C# (with examples)
Assignment 2
Ad

Viewers also liked (20)

PDF
eCertificate-JAVA-2
PPS
SAP for Beginners
DOC
Dhcp 11
PPS
Linux17 MySQL_installation
PPT
Linux13 concurrent versions system
PPS
Linux16 RPM
PDF
Disabled Tourist Guide - Morroco
PPS
Linux12 clustering onlinux
PPSX
Agile projectdevelopment
PPS
Linux14 Dynamic DNS
PPS
Linux15 dynamic dns-2
PDF
Feed management in an intensive shrimp farming system with bioflocs
PPT
Technique Of Shrimp Culture (Final) Vuong
PDF
Tilapia Cage Farm Management In Brazil
PPS
Difference WAMP and XAMPP
PPTX
Introduction to aquaculture
PDF
Polyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, Malaysia
PDF
Overfishing & Aquaculture
PPTX
Cage culture
PPT
Cage Culture 3
eCertificate-JAVA-2
SAP for Beginners
Dhcp 11
Linux17 MySQL_installation
Linux13 concurrent versions system
Linux16 RPM
Disabled Tourist Guide - Morroco
Linux12 clustering onlinux
Agile projectdevelopment
Linux14 Dynamic DNS
Linux15 dynamic dns-2
Feed management in an intensive shrimp farming system with bioflocs
Technique Of Shrimp Culture (Final) Vuong
Tilapia Cage Farm Management In Brazil
Difference WAMP and XAMPP
Introduction to aquaculture
Polyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, Malaysia
Overfishing & Aquaculture
Cage culture
Cage Culture 3
Ad

Similar to Collection framework (20)

PPTX
Advanced Java - UNIT 3.pptx
PPT
11000121065_NAITIK CHATTERJEE.ppt
PPTX
Java Collection Framework 2nd year B.Tech.pptx
PPTX
VTUOOPMCA5THMODULECollection OverV .pptx
PPTX
mca5thCollection OverViCollection O.pptx
PPTX
VTUOOPMCA5THMODULEvCollection OverV.pptx
PPTX
VTUOOPMCA5THMODULECollection OverVi.pptx
PPTX
22CS305-UNIT-1.pptx ADVANCE JAVA PROGRAMMING
PPTX
Java Collections Framework Inroduction with Video Tutorial
PPTX
Collections in java in detail for easy understanding
PPTX
14. collections
PDF
Collectn framework
PDF
Collectn framework copy
PPT
Collection framework
PPTX
Collection framework
PPTX
Slide Dasar Materi Java Collection Framework
PPTX
oop lecture framework,list,maps,collection
PDF
Java Collection Framework
PPTX
Collections framework in java
Advanced Java - UNIT 3.pptx
11000121065_NAITIK CHATTERJEE.ppt
Java Collection Framework 2nd year B.Tech.pptx
VTUOOPMCA5THMODULECollection OverV .pptx
mca5thCollection OverViCollection O.pptx
VTUOOPMCA5THMODULEvCollection OverV.pptx
VTUOOPMCA5THMODULECollection OverVi.pptx
22CS305-UNIT-1.pptx ADVANCE JAVA PROGRAMMING
Java Collections Framework Inroduction with Video Tutorial
Collections in java in detail for easy understanding
14. collections
Collectn framework
Collectn framework copy
Collection framework
Collection framework
Slide Dasar Materi Java Collection Framework
oop lecture framework,list,maps,collection
Java Collection Framework
Collections framework in java

More from Jainul Musani (20)

PDF
Core Java Interface Concepts for BCA Studetns
PDF
Java Abstract and Final Class for BCA students
PDF
Java Collection Framework for BCA Students
PDF
Simple Calculator using JavaFx a part of Advance Java
PDF
JavaFx Introduction, Basic JavaFx Architecture
PDF
ASP.NET 2010, WebServices Full Example for BCA Students
PDF
Palindrome Programme in PHP for BCA students
PDF
Leap Year Program in PHP for BCA students
PDF
"PHP and MySQL CRUD Operations for Student Management System"
PDF
Python: The Versatile Programming Language - Introduction
PPTX
Python a Versatile Programming Language - Introduction
PDF
React js t8 - inlinecss
PDF
React js t7 - forms-events
PDF
React js t6 -lifecycle
PDF
React js t5 - state
PDF
React js t4 - components
PDF
React js t3 - es6
PDF
React js t2 - jsx
PDF
React js t1 - introduction
PPTX
ExpressJs Session01
Core Java Interface Concepts for BCA Studetns
Java Abstract and Final Class for BCA students
Java Collection Framework for BCA Students
Simple Calculator using JavaFx a part of Advance Java
JavaFx Introduction, Basic JavaFx Architecture
ASP.NET 2010, WebServices Full Example for BCA Students
Palindrome Programme in PHP for BCA students
Leap Year Program in PHP for BCA students
"PHP and MySQL CRUD Operations for Student Management System"
Python: The Versatile Programming Language - Introduction
Python a Versatile Programming Language - Introduction
React js t8 - inlinecss
React js t7 - forms-events
React js t6 -lifecycle
React js t5 - state
React js t4 - components
React js t3 - es6
React js t2 - jsx
React js t1 - introduction
ExpressJs Session01

Recently uploaded (20)

PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Cell Structure & Organelles in detailed.
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Yogi Goddess Pres Conference Studio Updates
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Lesson notes of climatology university.
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Classroom Observation Tools for Teachers
PPTX
Cell Types and Its function , kingdom of life
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Cell Structure & Organelles in detailed.
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
2.FourierTransform-ShortQuestionswithAnswers.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Yogi Goddess Pres Conference Studio Updates
Orientation - ARALprogram of Deped to the Parents.pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx
O5-L3 Freight Transport Ops (International) V1.pdf
Final Presentation General Medicine 03-08-2024.pptx
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Lesson notes of climatology university.
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Weekly quiz Compilation Jan -July 25.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Classroom Observation Tools for Teachers
Cell Types and Its function , kingdom of life

Collection framework

  • 1. Collection Framework - I consists of THREE parts • interfaces, the abstract data types that the framework supports. • implementations, the concrete versions of these interfaces. • algorithms, the predefined actions that can be defined on either the interfaces or their implementations. 1
  • 2. Collection Framework - I • All implementations are unsynchronized. • All implementations are serializable and cloneable. • All implementations support having null elements. 2
  • 3. Collection Framework - I • The predefined algorithms for supporting the framework are found in the Collections and Arrays classes. 3
  • 4. Collection Framework - I • Framework - Four core interfaces • Two specializations for sorting 1. Collection 2. List 3. Set 4. Map 5. SortedSet 6. SortedMap 4
  • 5. Collection Framework - I Interface type and its implementation 5 Interface Implemented Set HashSet, LinkedHashSet, EnumSet SortedSet TreeSet List Vector, Stack, ArrayList, LinkedList Queue PriorityQueue, LinkedList Map Hashtable, HashMap, LinkedHashMap, WeakHashMap, IdentityHashMap SortedMap TreeMap
  • 6. Collection Framework - I Conversion of different Collection data types • Implementations of the Collection interface normally have a constructor that accepts a Collection object. • This enables you to convert a Collection to a different type of Collection, such as a Queue to a List, or a List to a Set, etc. 6
  • 7. Collection Framework - I Conversion of different Collection data types constructors of some implementations • public ArrayList (Collection c) • public HashSet (Collection c) • public LinkedList (Collection c) 7
  • 8. Collection Framework - I An example that converts a Queue to a List import java.util.*; public class MainClass { public static void main(String[] args) { Queue queue = new LinkedList(); queue.add("Hello"); queue.add("World"); List list = new ArrayList(queue); System.out.println(list); } // output :: [Hello, World] } 8
  • 9. Collection Framework - I This example converts a List to a Set. import java.util.*; public class MainClass { public static void main(String[] args) { List myList = new ArrayList(); myList.add("Hello"); myList.add("World"); myList.add("World"); Set set = new HashSet(myList); System.out.println(set); } } 9