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

What's hot (20)

Java - Collections framework
Java - Collections frameworkJava - Collections framework
Java - Collections framework
 
Collection Framework in java
Collection Framework in javaCollection Framework in java
Collection Framework in java
 
Java Collections Framework
Java Collections FrameworkJava Collections Framework
Java Collections Framework
 
Java Collections
Java  Collections Java  Collections
Java Collections
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
 
Collections framework in java
Collections framework in javaCollections framework in java
Collections framework in java
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
 
Collections In Java
Collections In JavaCollections In Java
Collections In Java
 
Java ArrayList Tutorial | Edureka
Java ArrayList Tutorial | EdurekaJava ArrayList Tutorial | Edureka
Java ArrayList Tutorial | Edureka
 
Java collections
Java collectionsJava collections
Java collections
 
collection framework in java
collection framework in javacollection framework in java
collection framework in java
 
Collections - Lists, Sets
Collections - Lists, Sets Collections - Lists, Sets
Collections - Lists, Sets
 
sets and maps
 sets and maps sets and maps
sets and maps
 
ArrayList in JAVA
ArrayList in JAVAArrayList in JAVA
ArrayList in JAVA
 
Collections - Array List
Collections - Array List Collections - Array List
Collections - Array List
 
Array in Java
Array in JavaArray in Java
Array in Java
 
MySQL Cursors
MySQL CursorsMySQL Cursors
MySQL Cursors
 
Generics in java
Generics in javaGenerics in java
Generics in java
 
Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0Overview of JPA (Java Persistence API) v2.0
Overview of JPA (Java Persistence API) v2.0
 
Java 8 Lambda Expressions
Java 8 Lambda ExpressionsJava 8 Lambda Expressions
Java 8 Lambda Expressions
 

Similar to JAVA Collections frame work ppt

oop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionoop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionssuseredfbe9
 
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.pptxhemanth248901
 
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 - notesswathirajstar
 
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
 
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
 
LJ_JAVA_FS_Collection.pptx
LJ_JAVA_FS_Collection.pptxLJ_JAVA_FS_Collection.pptx
LJ_JAVA_FS_Collection.pptxRaneez2
 
Collections Java e Google Collections
Collections Java e Google CollectionsCollections Java e Google Collections
Collections Java e Google CollectionsAndré Faria Gomes
 
Hash table in java
Hash table in javaHash table in java
Hash table in javasiriindian
 
List interface in collections framework
List interface in collections frameworkList interface in collections framework
List interface in collections frameworkRavi Chythanya
 

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)
 
Presentation1
Presentation1Presentation1
Presentation1
 
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 )
 
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...
 
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
 

Recently uploaded

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17Celine George
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use CasesTechSoup
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxCeline George
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfNirmal Dwivedi
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesSHIVANANDaRV
 

Recently uploaded (20)

Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
Introduction to TechSoup’s Digital Marketing Services and Use Cases
Introduction to TechSoup’s Digital Marketing  Services and Use CasesIntroduction to TechSoup’s Digital Marketing  Services and Use Cases
Introduction to TechSoup’s Digital Marketing Services and Use Cases
 
Our Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdfOur Environment Class 10 Science Notes pdf
Our Environment Class 10 Science Notes pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 

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; }