SlideShare a Scribd company logo
1 of 9
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

What's hot

What's hot (13)

JAVA Collections frame work ppt
 JAVA Collections frame work ppt JAVA Collections frame work ppt
JAVA Collections frame work ppt
 
Java collection
Java collectionJava collection
Java collection
 
Ei u4
Ei u4Ei u4
Ei u4
 
07 java collection
07 java collection07 java collection
07 java collection
 
Collections
CollectionsCollections
Collections
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - Java
 
Mule data weave_4
Mule data weave_4Mule data weave_4
Mule data weave_4
 
Stacks in data structure
Stacks  in data structureStacks  in data structure
Stacks in data structure
 
Collections
CollectionsCollections
Collections
 
System settings api
System settings apiSystem settings api
System settings api
 
Mule data weave_8
Mule data weave_8Mule data weave_8
Mule data weave_8
 
Collections and its types in C# (with examples)
Collections and its types in C# (with examples)Collections and its types in C# (with examples)
Collections and its types in C# (with examples)
 
Assignment 2
Assignment 2Assignment 2
Assignment 2
 

Viewers also liked

Linux17 MySQL_installation
Linux17 MySQL_installationLinux17 MySQL_installation
Linux17 MySQL_installationJainul Musani
 
Linux13 concurrent versions system
Linux13 concurrent versions systemLinux13 concurrent versions system
Linux13 concurrent versions systemJainul Musani
 
Disabled Tourist Guide - Morroco
Disabled Tourist Guide - MorrocoDisabled Tourist Guide - Morroco
Disabled Tourist Guide - MorrocoScott Rains
 
Linux12 clustering onlinux
Linux12 clustering onlinuxLinux12 clustering onlinux
Linux12 clustering onlinuxJainul Musani
 
Agile projectdevelopment
Agile projectdevelopmentAgile projectdevelopment
Agile projectdevelopmentJainul Musani
 
Linux15 dynamic dns-2
Linux15 dynamic dns-2Linux15 dynamic dns-2
Linux15 dynamic dns-2Jainul Musani
 
Feed management in an intensive shrimp farming system with bioflocs
Feed management in an intensive shrimp farming system with bioflocsFeed management in an intensive shrimp farming system with bioflocs
Feed management in an intensive shrimp farming system with bioflocsInternational Aquafeed
 
Technique Of Shrimp Culture (Final) Vuong
Technique Of Shrimp Culture (Final) VuongTechnique Of Shrimp Culture (Final) Vuong
Technique Of Shrimp Culture (Final) VuongRidzaludin
 
Tilapia Cage Farm Management In Brazil
Tilapia Cage Farm Management In BrazilTilapia Cage Farm Management In Brazil
Tilapia Cage Farm Management In BrazilAlberto Nunes
 
Difference WAMP and XAMPP
Difference WAMP and XAMPPDifference WAMP and XAMPP
Difference WAMP and XAMPPJainul Musani
 
Introduction to aquaculture
Introduction to aquacultureIntroduction to aquaculture
Introduction to aquaculturekumarsaurabh544
 
Polyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, Malaysia
Polyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, MalaysiaPolyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, Malaysia
Polyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, MalaysiaFayina19z
 
Overfishing & Aquaculture
Overfishing & AquacultureOverfishing & Aquaculture
Overfishing & Aquaculturetcooper66
 
Cage Culture 3
Cage Culture 3Cage Culture 3
Cage Culture 3Ridzaludin
 

Viewers also liked (20)

eCertificate-JAVA-2
eCertificate-JAVA-2eCertificate-JAVA-2
eCertificate-JAVA-2
 
SAP for Beginners
SAP for BeginnersSAP for Beginners
SAP for Beginners
 
Dhcp 11
Dhcp 11Dhcp 11
Dhcp 11
 
Linux17 MySQL_installation
Linux17 MySQL_installationLinux17 MySQL_installation
Linux17 MySQL_installation
 
Linux13 concurrent versions system
Linux13 concurrent versions systemLinux13 concurrent versions system
Linux13 concurrent versions system
 
Linux16 RPM
Linux16 RPMLinux16 RPM
Linux16 RPM
 
Disabled Tourist Guide - Morroco
Disabled Tourist Guide - MorrocoDisabled Tourist Guide - Morroco
Disabled Tourist Guide - Morroco
 
Linux12 clustering onlinux
Linux12 clustering onlinuxLinux12 clustering onlinux
Linux12 clustering onlinux
 
Agile projectdevelopment
Agile projectdevelopmentAgile projectdevelopment
Agile projectdevelopment
 
Linux14 Dynamic DNS
Linux14 Dynamic DNSLinux14 Dynamic DNS
Linux14 Dynamic DNS
 
Linux15 dynamic dns-2
Linux15 dynamic dns-2Linux15 dynamic dns-2
Linux15 dynamic dns-2
 
Feed management in an intensive shrimp farming system with bioflocs
Feed management in an intensive shrimp farming system with bioflocsFeed management in an intensive shrimp farming system with bioflocs
Feed management in an intensive shrimp farming system with bioflocs
 
Technique Of Shrimp Culture (Final) Vuong
Technique Of Shrimp Culture (Final) VuongTechnique Of Shrimp Culture (Final) Vuong
Technique Of Shrimp Culture (Final) Vuong
 
Tilapia Cage Farm Management In Brazil
Tilapia Cage Farm Management In BrazilTilapia Cage Farm Management In Brazil
Tilapia Cage Farm Management In Brazil
 
Difference WAMP and XAMPP
Difference WAMP and XAMPPDifference WAMP and XAMPP
Difference WAMP and XAMPP
 
Introduction to aquaculture
Introduction to aquacultureIntroduction to aquaculture
Introduction to aquaculture
 
Polyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, Malaysia
Polyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, MalaysiaPolyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, Malaysia
Polyculture and Integrated Tilapia Farming Systems - Kuala Lumpur, Malaysia
 
Overfishing & Aquaculture
Overfishing & AquacultureOverfishing & Aquaculture
Overfishing & Aquaculture
 
Cage culture
Cage cultureCage culture
Cage culture
 
Cage Culture 3
Cage Culture 3Cage Culture 3
Cage Culture 3
 

Similar to Collection framework (20)

Java collections
Java collectionsJava collections
Java collections
 
Collections
CollectionsCollections
Collections
 
Collection framework
Collection frameworkCollection framework
Collection framework
 
Lists
ListsLists
Lists
 
Java Collections Tutorials
Java Collections TutorialsJava Collections Tutorials
Java Collections Tutorials
 
Collection
CollectionCollection
Collection
 
JavaCollections.ppt
JavaCollections.pptJavaCollections.ppt
JavaCollections.ppt
 
JavaCollections.ppt
JavaCollections.pptJavaCollections.ppt
JavaCollections.ppt
 
12_-_Collections_Framework
12_-_Collections_Framework12_-_Collections_Framework
12_-_Collections_Framework
 
Collections
CollectionsCollections
Collections
 
Best core & advanced java classes in mumbai
Best core & advanced java classes in mumbaiBest core & advanced java classes in mumbai
Best core & advanced java classes in mumbai
 
Java Collections
Java  Collections Java  Collections
Java Collections
 
Collections Training
Collections TrainingCollections Training
Collections Training
 
Collection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshanCollection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshan
 
Collections - Array List
Collections - Array List Collections - Array List
Collections - Array List
 
collection framework.pptx
collection framework.pptxcollection framework.pptx
collection framework.pptx
 
Java collections
Java collectionsJava collections
Java collections
 
Learn advanced java programming
Learn advanced java programmingLearn advanced java programming
Learn advanced java programming
 
Collectn framework copy
Collectn framework   copyCollectn framework   copy
Collectn framework copy
 
Collectn framework
Collectn frameworkCollectn framework
Collectn framework
 

More from Jainul Musani

More from Jainul Musani (20)

React js t8 - inlinecss
React js   t8 - inlinecssReact js   t8 - inlinecss
React js t8 - inlinecss
 
React js t7 - forms-events
React js   t7 - forms-eventsReact js   t7 - forms-events
React js t7 - forms-events
 
React js t6 -lifecycle
React js   t6 -lifecycleReact js   t6 -lifecycle
React js t6 -lifecycle
 
React js t5 - state
React js   t5 - stateReact js   t5 - state
React js t5 - state
 
React js t4 - components
React js   t4 - componentsReact js   t4 - components
React js t4 - components
 
React js t3 - es6
React js   t3 - es6React js   t3 - es6
React js t3 - es6
 
React js t2 - jsx
React js   t2 - jsxReact js   t2 - jsx
React js t2 - jsx
 
React js t1 - introduction
React js   t1 - introductionReact js   t1 - introduction
React js t1 - introduction
 
ExpressJs Session01
ExpressJs Session01ExpressJs Session01
ExpressJs Session01
 
NodeJs Session03
NodeJs Session03NodeJs Session03
NodeJs Session03
 
NodeJs Session02
NodeJs Session02NodeJs Session02
NodeJs Session02
 
Nodejs Session01
Nodejs Session01Nodejs Session01
Nodejs Session01
 
Java exercise1
Java exercise1Java exercise1
Java exercise1
 
Fundamentals of JDBC
Fundamentals of JDBCFundamentals of JDBC
Fundamentals of JDBC
 
Core Java Special
Core Java SpecialCore Java Special
Core Java Special
 
Core Java Special
Core Java SpecialCore Java Special
Core Java Special
 
Cassandra-vs-MongoDB
Cassandra-vs-MongoDBCassandra-vs-MongoDB
Cassandra-vs-MongoDB
 
MongoDB-SESSION03
MongoDB-SESSION03MongoDB-SESSION03
MongoDB-SESSION03
 
MongoDB-SESSION02
MongoDB-SESSION02MongoDB-SESSION02
MongoDB-SESSION02
 
MongoDB-SESION01
MongoDB-SESION01MongoDB-SESION01
MongoDB-SESION01
 

Recently uploaded

Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 

Recently uploaded (20)

Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 

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