SlideShare a Scribd company logo
COLLECTIONS
LIST SET
MAP
Sorted Map
Sorted Set
COLLECTIONS
The main java collections are List,Set and Map
LIST
the list store the elements in sequential form. It stores the elements in the orderstores the elements in the order
they were added, similar to an array only growable. the list may containthey were added, similar to an array only growable. the list may contain
duplicatesduplicates
SET
A Set is a collection that cannot contain any duplicate values,store only unique
values
MAP
A Map Is a collection that store key value pairs, A key is an object that you use
to retrieve a value at a later date.
 AddAdd
 AddAllAddAll
 RemoveRemove
 RemoveAllRemoveAll
 ClearClear
 ContainsContains
 ContainsAllContainsAll
 IsEmptyIsEmpty
 SizeSize
 ToArrayToArray
 ItretorItretor
 ComparatorComparator
 SortSort
 PutPut
Some of List Implementations are given below....
 ArrayList
 LinkedList
 MixedTypeArrayList
ARRAY LIST
ArrayList is a resizable array implementation like vector
LINKED LIST
A linkedList is a doublyLinkedlist implementation and it may
provide better perfomance than arraylist
Some of Set implementations are given below
 HashSet
 LinkedHashset
 Treeset
HashSet
A hashset is a set backed by a hash table. It extends from
Abstractset class
TreeSet
A balanced binary tree implementation. imposes an ordering on
its elements and extend from Sortedset interface abstractset
classes
Some of MAP implementations are given below
 HashMap
 TreeMap
 HashTable
HashMap
A hashMap is a implementation of map hashTable and it support null keys and
values
TreeMap
TreeMap is a balnced binary tree implementation and imposes an ordering on
its elements
Hashtable
synchronized hash table implementation of map interface
Iterator enables you to cycle through a collection, obtaining or removing
elements. Before you can access a collection through an iterator, you must
obtain one. Each of the collection classes provides an iterator( ) method that
returns an iterator to the start of the collection.
Collections.sort() static Method:
public List<Person> SortByAge(){
PersonService personService = new PersonService(new
PersonDataAccessObject(AddressBook.PersonFile));
List<Person> personList = personService.FindAllPerson();
Collections.sort(personList, new Agecomparator());
return personList;
}
here the collections that keeptheir elements sorted and the iterator are
guaranteed to travese in sorted order
public List<City> SortCityByComparator(){
CityService cityService = new CityService(new
CityDataAccessObject(AddressBook.CityFile));
List<City> CityList = cityService.FindAllCity();
Collections.sort(CityList , new
CityNameComparator());
return CityList;
}
 JAVA Collections frame work ppt

More Related Content

What's hot

Java collections concept
Java collections conceptJava collections concept
Java collections concept
kumar gaurav
 
Java collection
Java collectionJava collection
Java collection
Arati Gadgil
 
collection framework in java
collection framework in javacollection framework in java
collection framework in java
MANOJ KUMAR
 
Java Collections Framework
Java Collections FrameworkJava Collections Framework
Java Collections Framework
Sony India Software Center
 
Collections - Lists, Sets
Collections - Lists, Sets Collections - Lists, Sets
Collections - Lists, Sets
Hitesh-Java
 
Collections In Java
Collections In JavaCollections In Java
Collections In JavaBinoj T E
 
Java Collections
Java  Collections Java  Collections
Collections in Java Notes
Collections in Java NotesCollections in Java Notes
Collections in Java Notes
Shalabh Chaudhary
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
ankitgarg_er
 
Major Java 8 features
Major Java 8 featuresMajor Java 8 features
Major Java 8 features
Sanjoy Kumar Roy
 
Java Generics
Java GenericsJava Generics
Java Generics
Zülfikar Karakaya
 
How Hashmap works internally in java
How Hashmap works internally  in javaHow Hashmap works internally  in java
How Hashmap works internally in java
Ramakrishna Joshi
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
Minal Maniar
 
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Sagar Verma
 
Java collections notes
Java collections notesJava collections notes
Java collections notes
Surendar Meesala
 
Introduction to Java 8
Introduction to Java 8Introduction to Java 8
Introduction to Java 8
Knoldus Inc.
 
Java 8 - Features Overview
Java 8 - Features OverviewJava 8 - Features Overview
Java 8 - Features Overview
Sergii Stets
 
Spring JDBCTemplate
Spring JDBCTemplateSpring JDBCTemplate
Spring JDBCTemplateGuo Albert
 

What's hot (20)

Java collections concept
Java collections conceptJava collections concept
Java collections concept
 
Java collection
Java collectionJava collection
Java collection
 
collection framework in java
collection framework in javacollection framework in java
collection framework in java
 
Generics
GenericsGenerics
Generics
 
Java Collections Framework
Java Collections FrameworkJava Collections Framework
Java Collections Framework
 
Collections - Lists, Sets
Collections - Lists, Sets Collections - Lists, Sets
Collections - Lists, Sets
 
Collections In Java
Collections In JavaCollections In Java
Collections In Java
 
Java Collections
Java  Collections Java  Collections
Java Collections
 
Collections in Java Notes
Collections in Java NotesCollections in Java Notes
Collections in Java Notes
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
 
Major Java 8 features
Major Java 8 featuresMajor Java 8 features
Major Java 8 features
 
Java Generics
Java GenericsJava Generics
Java Generics
 
How Hashmap works internally in java
How Hashmap works internally  in javaHow Hashmap works internally  in java
How Hashmap works internally in java
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
 
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
 
Java collections notes
Java collections notesJava collections notes
Java collections notes
 
Presentation1
Presentation1Presentation1
Presentation1
 
Introduction to Java 8
Introduction to Java 8Introduction to Java 8
Introduction to Java 8
 
Java 8 - Features Overview
Java 8 - Features OverviewJava 8 - Features Overview
Java 8 - Features Overview
 
Spring JDBCTemplate
Spring JDBCTemplateSpring JDBCTemplate
Spring JDBCTemplate
 

Similar to JAVA Collections frame work ppt

C# Collection classes
C# Collection classesC# Collection classes
C# Collection classes
MohitKumar1985
 
oop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionoop lecture framework,list,maps,collection
oop lecture framework,list,maps,collection
ssuseredfbe9
 
Array list(1)
Array list(1)Array list(1)
Array list(1)
abdullah619
 
Java collections-interview-questions
Java collections-interview-questionsJava collections-interview-questions
Java collections-interview-questionsyearninginjava
 
collectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptxcollectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptx
hemanth248901
 
Java.util
Java.utilJava.util
Java.util
Ramakrishna kapa
 
DSA UNIT II ARRAY AND LIST - notes
DSA UNIT II ARRAY AND LIST - notesDSA UNIT II ARRAY AND LIST - notes
DSA UNIT II ARRAY AND LIST - notes
swathirajstar
 
Array list (java platform se 8 )
Array list (java platform se 8 )Array list (java platform se 8 )
Array list (java platform se 8 )
charan kumar
 
LJ_JAVA_FS_Collection.pptx
LJ_JAVA_FS_Collection.pptxLJ_JAVA_FS_Collection.pptx
LJ_JAVA_FS_Collection.pptx
Raneez2
 
arraylistinjava.pptx
arraylistinjava.pptxarraylistinjava.pptx
arraylistinjava.pptx
dintakurthigayathri9
 
Collections and generics
Collections and genericsCollections and generics
Collections and generics
Muthukumaran Subramanian
 
javacollections.pdf
javacollections.pdfjavacollections.pdf
javacollections.pdf
ManojKandhasamy1
 
Collections Java e Google Collections
Collections Java e Google CollectionsCollections Java e Google Collections
Collections Java e Google Collections
André Faria Gomes
 
Hash table in java
Hash table in javaHash table in java
Hash table in java
siriindian
 
List interface in collections framework
List interface in collections frameworkList interface in collections framework
List interface in collections framework
Ravi Chythanya
 
Assignment4 Assignment 4 Hashtables In this assignment we w.pdf
Assignment4 Assignment 4 Hashtables In this assignment we w.pdfAssignment4 Assignment 4 Hashtables In this assignment we w.pdf
Assignment4 Assignment 4 Hashtables In this assignment we w.pdf
kksrivastava1
 
collection framework.pptx
collection framework.pptxcollection framework.pptx
collection framework.pptx
SoniaKapoor56
 

Similar to JAVA Collections frame work ppt (20)

C# Collection classes
C# Collection classesC# Collection classes
C# Collection classes
 
oop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionoop lecture framework,list,maps,collection
oop lecture framework,list,maps,collection
 
Array list(1)
Array list(1)Array list(1)
Array list(1)
 
16 containers
16   containers16   containers
16 containers
 
Java collections-interview-questions
Java collections-interview-questionsJava collections-interview-questions
Java collections-interview-questions
 
collectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptxcollectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptx
 
Java.util
Java.utilJava.util
Java.util
 
DSA UNIT II ARRAY AND LIST - notes
DSA UNIT II ARRAY AND LIST - notesDSA UNIT II ARRAY AND LIST - notes
DSA UNIT II ARRAY AND LIST - notes
 
Array list (java platform se 8 )
Array list (java platform se 8 )Array list (java platform se 8 )
Array list (java platform se 8 )
 
LJ_JAVA_FS_Collection.pptx
LJ_JAVA_FS_Collection.pptxLJ_JAVA_FS_Collection.pptx
LJ_JAVA_FS_Collection.pptx
 
arraylistinjava.pptx
arraylistinjava.pptxarraylistinjava.pptx
arraylistinjava.pptx
 
Collections and generics
Collections and genericsCollections and generics
Collections and generics
 
javacollections.pdf
javacollections.pdfjavacollections.pdf
javacollections.pdf
 
20 ch22 collections
20 ch22 collections20 ch22 collections
20 ch22 collections
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
 
Collections Java e Google Collections
Collections Java e Google CollectionsCollections Java e Google Collections
Collections Java e Google Collections
 
Hash table in java
Hash table in javaHash table in java
Hash table in java
 
List interface in collections framework
List interface in collections frameworkList interface in collections framework
List interface in collections framework
 
Assignment4 Assignment 4 Hashtables In this assignment we w.pdf
Assignment4 Assignment 4 Hashtables In this assignment we w.pdfAssignment4 Assignment 4 Hashtables In this assignment we w.pdf
Assignment4 Assignment 4 Hashtables In this assignment we w.pdf
 
collection framework.pptx
collection framework.pptxcollection framework.pptx
collection framework.pptx
 

Recently uploaded

PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 

Recently uploaded (20)

PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 

JAVA Collections frame work ppt

  • 1.
  • 3. COLLECTIONS The main java collections are List,Set and Map LIST the list store the elements in sequential form. It stores the elements in the orderstores the elements in the order they were added, similar to an array only growable. the list may containthey were added, similar to an array only growable. the list may contain duplicatesduplicates SET A Set is a collection that cannot contain any duplicate values,store only unique values MAP A Map Is a collection that store key value pairs, A key is an object that you use to retrieve a value at a later date.
  • 4.  AddAdd  AddAllAddAll  RemoveRemove  RemoveAllRemoveAll  ClearClear  ContainsContains  ContainsAllContainsAll  IsEmptyIsEmpty  SizeSize  ToArrayToArray  ItretorItretor  ComparatorComparator  SortSort  PutPut
  • 5. Some of List Implementations are given below....  ArrayList  LinkedList  MixedTypeArrayList ARRAY LIST ArrayList is a resizable array implementation like vector LINKED LIST A linkedList is a doublyLinkedlist implementation and it may provide better perfomance than arraylist
  • 6. Some of Set implementations are given below  HashSet  LinkedHashset  Treeset HashSet A hashset is a set backed by a hash table. It extends from Abstractset class TreeSet A balanced binary tree implementation. imposes an ordering on its elements and extend from Sortedset interface abstractset classes
  • 7. Some of MAP implementations are given below  HashMap  TreeMap  HashTable HashMap A hashMap is a implementation of map hashTable and it support null keys and values TreeMap TreeMap is a balnced binary tree implementation and imposes an ordering on its elements Hashtable synchronized hash table implementation of map interface
  • 8. Iterator enables you to cycle through a collection, obtaining or removing elements. Before you can access a collection through an iterator, you must obtain one. Each of the collection classes provides an iterator( ) method that returns an iterator to the start of the collection.
  • 9. Collections.sort() static Method: public List<Person> SortByAge(){ PersonService personService = new PersonService(new PersonDataAccessObject(AddressBook.PersonFile)); List<Person> personList = personService.FindAllPerson(); Collections.sort(personList, new Agecomparator()); return personList; } here the collections that keeptheir elements sorted and the iterator are guaranteed to travese in sorted order
  • 10. public List<City> SortCityByComparator(){ CityService cityService = new CityService(new CityDataAccessObject(AddressBook.CityFile)); List<City> CityList = cityService.FindAllCity(); Collections.sort(CityList , new CityNameComparator()); return CityList; }