SlideShare a Scribd company logo
Topics for Today’s Session
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Collection
Framework
Interfaces Queue
Collection Framework
Hierarchy
List Set
Java Collection Framework
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Collection Framework
It provides an architecture to store and manipulate a group of objects
Using Java Collections various operations can be performed on the data like searching,
sorting, insertion, manipulation, deletion, etc.
Java Collection framework provides many interfaces and classes
Collections are the containers that groups multiple items in a single unit
01
02
03
04
Java Collection Framework
Heirarchy
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Collection Framework Hierarchy
Iterable
Collection
Queue Set
ArrayList
LinkedList
Vector
Deque
SortedSet
TreeSet
List
ArrayDeque
PriorityQueue HashSet
LinkedHashSet
Interface
Class
Extends
Implements
Stack
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Collection Framework Hierarchy
Iterable
Collection
Queue Set
ArrayList
LinkedList
Vector
Deque
SortedSet
TreeSet
List
Stack
ArrayDeque
PriorityQueue HashSet
LinkedHashSet
Interface
Class
Extends
Implements
Map
HashMap
SortedMap
HashTable
TreeMap
Java Interfaces
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Interface
Interfaces are the reference types which are similar to classes but contains only abstract methods
Interface cannot be instantiated
Contains only abstract methods
An interface can extend
multiple interfaces
Interface is implemented by a
class
Interface do not contain
constructors or instance fields
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Interface
Iterable
The Iterable interface is the root interface for all the collection classes. The Collection interface along with all its
subclasses also implement the Iterable interface.
Methods Iterator<T> iterator()
Collection
Collection interface is implemented by all the classes in the collection framework & declares the methods that every
collection will contain
Methods Boolean add(Object obj)
Iterator The Iterator interface provides the facility of iterating the elements only in a forward direction.
Methods public boolean hasNext() public Object next() public void remove()
Boolean addAll(Object obj) void clear() ...
Java Lists
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
LinkedListVector
Java List
Java List is an interface that extents the Collection and contains ordered collection of elements including duplicate values
ArrayListList Types
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
LinkedList
Java List
ArrayList
Vector
ArrayList is the implementation of
List Interface where the elements can
be dynamically added or removed
from the list
The size of the list is increased
dynamically if the elements are
added more than the initial size
0 1 2 3 4 5
ArrayList object = new ArrayList ();
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
LinkedList
Java List
ArrayList
Vector
java.utils.ArrayList
boolean add(Collection c)
void add(int index, Object
element)
void clear()
Object[] toArray() void trimToSize()
Object clone()int lastIndexOf(Object o)
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
LinkedList
Java List
ArrayList
Vector
Linked List is a sequence of links which
contains items
Linkedlist object = new Linkedlist();
Singly Linked List
Doubly Linked List
Each link contains a connection to another
link
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
LinkedList
Java List
ArrayList
Vector
Singly Linked List Doubly Linked List
Each node in this list stores the data of the node and a pointer or reference to the next node in the list
Prev Next Prev Next Prev Next
NULL
HEAD
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
LinkedList
Java List
ArrayList
Vector
Singly Linked List Doubly Linked List
Doubly Linked list has two references: one to the next node and another to previous node
Next
NULL
HEAD
NodePrev
NextNodePrev
NextNodePrev
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
LinkedList
Java List
ArrayList
Vector
Java.util.Linkedlist
boolean add(Object c) boolean contains(Object o)
void add (int index, Object
element)
int indexOf(Object
element)
int lastIndexOf(Object
element)
void addLast(Object o)void addFirst(Object o)
int size() boolean remove(Object o)
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
LinkedList
Java List
ArrayList
Vector
Vectors are similar to arrays, where
the elements of the vector object can
be accessed via an index into the
vector
Vector implements a dynamic array
and is not limited to a specific size
and is synchronized
Vector object = new Vector(size,increment);
0 1 2 3 4 5
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
LinkedList
Java List
ArrayList
Vector
Java.util.Vectors
boolean add(Object c)
void add (int index, Object
element)
int indexOf(Object
element)
int lastIndexOf(Object
element)
boolean contains(Object
element)
void clear()
int size() boolean remove(Object o)
Java Queue
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Queue
0 1 2 3 … … … n
Insert Remove
Rear Front
Queue in Java follows a FIFO approach i.e. it orders
the elements in First In First Out manner
The first element is removed first and last element
is removed in the end
Queue<Integer> q = new LinkedList<>();
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Queue
Java.util.Queue
boolean add(object) boolean offer(object)
Object poll()Object remove()
Object element() Object peek()
Java Set
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Sets
A Set refers to a collection that cannot contain
duplicate elements
It is mainly used to model the mathematical set
abstraction
LinkedHashSet
TreeSet
HashSet
Set has its implementation in various classes
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Sets
LinkedHashSet
TreeSet
HashSet
Java HashSet class creates a collection that use a hash table for storage
Hashset only contain unique elements and it inherits the AbstractSet class and implements Set
interface
It uses a mechanism hashing to store the elements
HashSet<String> al= new HashSet();
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Sets
LinkedHashSet
TreeSet
HashSet
Java.util.HashSet
boolean add(Object c) boolean contains(Object o)
Iterator iterator() Object clone()
boolean isEmpty()void clear()
int size() boolean remove(Object o)
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Sets
LinkedHashSet
TreeSet
HashSet
Java LinkedHashSet class is a Hash table and Linked list implementation of the set interface
It contains only unique elements
It provides all optional set operations and maintains insertion order
LinkedHashSet<String> al=new LinkedHashSet();
This class inherits methods from other classes
AbstractCollection Object Set
HashSet AbstractSet
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Sets
LinkedHashSet
TreeSet
HashSet
TreeSet class implements the Set interface that uses a tree for storage
The objects of this class are unique and are stored in the ascending order
It inherits AbstractSet class and implements NavigableSet interface
TreeSet<String> al=new TreeSet<String>();
JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training
Java Sets
LinkedHashSet
TreeSet
HashSet
Java.util.TreeSet
boolean addAll(Collection c) boolean contains(Object o) boolean isEmpty()
Object last() int size()
void clear()boolean remove(Object o)
Object clone() Object first()
void add(Object o)
Java Collections | Collections Framework in Java | Java Tutorial For Beginners | Edureka

More Related Content

What's hot

JAVA Collections frame work ppt
 JAVA Collections frame work ppt JAVA Collections frame work ppt
JAVA Collections frame work ppt
Ranjith Alappadan
 
Java Collections Framework
Java Collections FrameworkJava Collections Framework
Java Collections Framework
Sony India Software Center
 
Collections In Java
Collections In JavaCollections In Java
Collections In JavaBinoj T E
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & Streams
NewCircle Training
 
Java Collections
Java  Collections Java  Collections
Java IO
Java IOJava IO
Java IO
UTSAB NEUPANE
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - Java
Drishti Bhalla
 
collection framework in java
collection framework in javacollection framework in java
collection framework in java
MANOJ KUMAR
 
Wrapper class
Wrapper classWrapper class
Wrapper class
kamal kotecha
 
Java collections notes
Java collections notesJava collections notes
Java collections notes
Surendar Meesala
 
Java collection
Java collectionJava collection
Java collection
Arati Gadgil
 
07 java collection
07 java collection07 java collection
07 java collection
Abhishek Khune
 
Java threads
Java threadsJava threads
Java threads
Prabhakaran V M
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
ankitgarg_er
 
Collections in Java Notes
Collections in Java NotesCollections in Java Notes
Collections in Java Notes
Shalabh Chaudhary
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
NexThoughts Technologies
 
Java Lambda Expressions.pptx
Java Lambda Expressions.pptxJava Lambda Expressions.pptx
Java Lambda Expressions.pptx
SameerAhmed593310
 
Java exception
Java exception Java exception
Java exception
Arati Gadgil
 
Introduction to Java 8
Introduction to Java 8Introduction to Java 8
Introduction to Java 8
Knoldus Inc.
 

What's hot (20)

JAVA Collections frame work ppt
 JAVA Collections frame work ppt JAVA Collections frame work ppt
JAVA Collections frame work ppt
 
Java Collections Framework
Java Collections FrameworkJava Collections Framework
Java Collections Framework
 
Collections In Java
Collections In JavaCollections In Java
Collections In Java
 
Java 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & StreamsJava 8 Lambda Expressions & Streams
Java 8 Lambda Expressions & Streams
 
Java Collections
Java  Collections Java  Collections
Java Collections
 
Java IO
Java IOJava IO
Java IO
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - Java
 
collection framework in java
collection framework in javacollection framework in java
collection framework in java
 
Wrapper class
Wrapper classWrapper class
Wrapper class
 
Java collections notes
Java collections notesJava collections notes
Java collections notes
 
Java collection
Java collectionJava collection
Java collection
 
07 java collection
07 java collection07 java collection
07 java collection
 
Java threads
Java threadsJava threads
Java threads
 
Generics
GenericsGenerics
Generics
 
Java Collection framework
Java Collection frameworkJava Collection framework
Java Collection framework
 
Collections in Java Notes
Collections in Java NotesCollections in Java Notes
Collections in Java Notes
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Java Lambda Expressions.pptx
Java Lambda Expressions.pptxJava Lambda Expressions.pptx
Java Lambda Expressions.pptx
 
Java exception
Java exception Java exception
Java exception
 
Introduction to Java 8
Introduction to Java 8Introduction to Java 8
Introduction to Java 8
 

Similar to Java Collections | Collections Framework in Java | Java Tutorial For Beginners | Edureka

Advanced Java - UNIT 3.pptx
Advanced Java - UNIT 3.pptxAdvanced Java - UNIT 3.pptx
Advanced Java - UNIT 3.pptx
eyemitra1
 
List interface in collections framework
List interface in collections frameworkList interface in collections framework
List interface in collections framework
Ravi Chythanya
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
talha ijaz
 
Java collections
Java collectionsJava collections
Java collections
Hamid Ghorbani
 
collection framework.pptx
collection framework.pptxcollection framework.pptx
collection framework.pptx
SoniaKapoor56
 
11000121065_NAITIK CHATTERJEE.ppt
11000121065_NAITIK CHATTERJEE.ppt11000121065_NAITIK CHATTERJEE.ppt
11000121065_NAITIK CHATTERJEE.ppt
NaitikChatterjee
 
Java ArrayList Tutorial | Edureka
Java ArrayList Tutorial | EdurekaJava ArrayList Tutorial | Edureka
Java ArrayList Tutorial | Edureka
Edureka!
 
Collection framework
Collection frameworkCollection framework
Collection framework
DilvarSingh2
 
JAVA(UNIT 4)
JAVA(UNIT 4)JAVA(UNIT 4)
JAVA(UNIT 4)
SURBHI SAROHA
 
Lecture 24
Lecture 24Lecture 24
Lecture 24
Debasish Pratihari
 
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
 
Java.util
Java.utilJava.util
Java.util
Ramakrishna kapa
 
Collections - Lists & sets
Collections - Lists & setsCollections - Lists & sets
Collections - Lists & sets
RatnaJava
 
adjava_23_bcs_vision_academy_sachinsir.pdf
adjava_23_bcs_vision_academy_sachinsir.pdfadjava_23_bcs_vision_academy_sachinsir.pdf
adjava_23_bcs_vision_academy_sachinsir.pdf
akankshasorate1
 
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docxNJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
curwenmichaela
 
Collection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshanCollection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshan
Zeeshan Khan
 
Lambda functions in java 8
Lambda functions in java 8Lambda functions in java 8
Lambda functions in java 8James Brown
 
Collections Java e Google Collections
Collections Java e Google CollectionsCollections Java e Google Collections
Collections Java e Google Collections
André Faria Gomes
 

Similar to Java Collections | Collections Framework in Java | Java Tutorial For Beginners | Edureka (20)

Advanced Java - UNIT 3.pptx
Advanced Java - UNIT 3.pptxAdvanced Java - UNIT 3.pptx
Advanced Java - UNIT 3.pptx
 
List interface in collections framework
List interface in collections frameworkList interface in collections framework
List interface in collections framework
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Java collections
Java collectionsJava collections
Java collections
 
collection framework.pptx
collection framework.pptxcollection framework.pptx
collection framework.pptx
 
11000121065_NAITIK CHATTERJEE.ppt
11000121065_NAITIK CHATTERJEE.ppt11000121065_NAITIK CHATTERJEE.ppt
11000121065_NAITIK CHATTERJEE.ppt
 
Java ArrayList Tutorial | Edureka
Java ArrayList Tutorial | EdurekaJava ArrayList Tutorial | Edureka
Java ArrayList Tutorial | Edureka
 
Collection framework
Collection frameworkCollection framework
Collection framework
 
JAVA(UNIT 4)
JAVA(UNIT 4)JAVA(UNIT 4)
JAVA(UNIT 4)
 
Lecture 24
Lecture 24Lecture 24
Lecture 24
 
20 ch22 collections
20 ch22 collections20 ch22 collections
20 ch22 collections
 
Array list (java platform se 8 )
Array list (java platform se 8 )Array list (java platform se 8 )
Array list (java platform se 8 )
 
Java.util
Java.utilJava.util
Java.util
 
Collection framework
Collection frameworkCollection framework
Collection framework
 
Collections - Lists & sets
Collections - Lists & setsCollections - Lists & sets
Collections - Lists & sets
 
adjava_23_bcs_vision_academy_sachinsir.pdf
adjava_23_bcs_vision_academy_sachinsir.pdfadjava_23_bcs_vision_academy_sachinsir.pdf
adjava_23_bcs_vision_academy_sachinsir.pdf
 
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docxNJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
NJB_Coll_Lib1javadocallclasses-frame.htmlAll ClassesDynamicArr.docx
 
Collection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshanCollection framework (completenotes) zeeshan
Collection framework (completenotes) zeeshan
 
Lambda functions in java 8
Lambda functions in java 8Lambda functions in java 8
Lambda functions in java 8
 
Collections Java e Google Collections
Collections Java e Google CollectionsCollections Java e Google Collections
Collections Java e Google Collections
 

More from Edureka!

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
Edureka!
 

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 

Recently uploaded

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 

Recently uploaded (20)

Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 

Java Collections | Collections Framework in Java | Java Tutorial For Beginners | Edureka

  • 1.
  • 2. Topics for Today’s Session JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Collection Framework Interfaces Queue Collection Framework Hierarchy List Set
  • 4. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Collection Framework It provides an architecture to store and manipulate a group of objects Using Java Collections various operations can be performed on the data like searching, sorting, insertion, manipulation, deletion, etc. Java Collection framework provides many interfaces and classes Collections are the containers that groups multiple items in a single unit 01 02 03 04
  • 6. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Collection Framework Hierarchy Iterable Collection Queue Set ArrayList LinkedList Vector Deque SortedSet TreeSet List ArrayDeque PriorityQueue HashSet LinkedHashSet Interface Class Extends Implements Stack
  • 7. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Collection Framework Hierarchy Iterable Collection Queue Set ArrayList LinkedList Vector Deque SortedSet TreeSet List Stack ArrayDeque PriorityQueue HashSet LinkedHashSet Interface Class Extends Implements Map HashMap SortedMap HashTable TreeMap
  • 9. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Interface Interfaces are the reference types which are similar to classes but contains only abstract methods Interface cannot be instantiated Contains only abstract methods An interface can extend multiple interfaces Interface is implemented by a class Interface do not contain constructors or instance fields
  • 10. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Interface Iterable The Iterable interface is the root interface for all the collection classes. The Collection interface along with all its subclasses also implement the Iterable interface. Methods Iterator<T> iterator() Collection Collection interface is implemented by all the classes in the collection framework & declares the methods that every collection will contain Methods Boolean add(Object obj) Iterator The Iterator interface provides the facility of iterating the elements only in a forward direction. Methods public boolean hasNext() public Object next() public void remove() Boolean addAll(Object obj) void clear() ...
  • 12. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training LinkedListVector Java List Java List is an interface that extents the Collection and contains ordered collection of elements including duplicate values ArrayListList Types
  • 13. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training LinkedList Java List ArrayList Vector ArrayList is the implementation of List Interface where the elements can be dynamically added or removed from the list The size of the list is increased dynamically if the elements are added more than the initial size 0 1 2 3 4 5 ArrayList object = new ArrayList ();
  • 14. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training LinkedList Java List ArrayList Vector java.utils.ArrayList boolean add(Collection c) void add(int index, Object element) void clear() Object[] toArray() void trimToSize() Object clone()int lastIndexOf(Object o)
  • 15. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training LinkedList Java List ArrayList Vector Linked List is a sequence of links which contains items Linkedlist object = new Linkedlist(); Singly Linked List Doubly Linked List Each link contains a connection to another link
  • 16. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training LinkedList Java List ArrayList Vector Singly Linked List Doubly Linked List Each node in this list stores the data of the node and a pointer or reference to the next node in the list Prev Next Prev Next Prev Next NULL HEAD
  • 17. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training LinkedList Java List ArrayList Vector Singly Linked List Doubly Linked List Doubly Linked list has two references: one to the next node and another to previous node Next NULL HEAD NodePrev NextNodePrev NextNodePrev
  • 18. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training LinkedList Java List ArrayList Vector Java.util.Linkedlist boolean add(Object c) boolean contains(Object o) void add (int index, Object element) int indexOf(Object element) int lastIndexOf(Object element) void addLast(Object o)void addFirst(Object o) int size() boolean remove(Object o)
  • 19. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training LinkedList Java List ArrayList Vector Vectors are similar to arrays, where the elements of the vector object can be accessed via an index into the vector Vector implements a dynamic array and is not limited to a specific size and is synchronized Vector object = new Vector(size,increment); 0 1 2 3 4 5
  • 20. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training LinkedList Java List ArrayList Vector Java.util.Vectors boolean add(Object c) void add (int index, Object element) int indexOf(Object element) int lastIndexOf(Object element) boolean contains(Object element) void clear() int size() boolean remove(Object o)
  • 22. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Queue 0 1 2 3 … … … n Insert Remove Rear Front Queue in Java follows a FIFO approach i.e. it orders the elements in First In First Out manner The first element is removed first and last element is removed in the end Queue<Integer> q = new LinkedList<>();
  • 23. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Queue Java.util.Queue boolean add(object) boolean offer(object) Object poll()Object remove() Object element() Object peek()
  • 25. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Sets A Set refers to a collection that cannot contain duplicate elements It is mainly used to model the mathematical set abstraction LinkedHashSet TreeSet HashSet Set has its implementation in various classes
  • 26. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Sets LinkedHashSet TreeSet HashSet Java HashSet class creates a collection that use a hash table for storage Hashset only contain unique elements and it inherits the AbstractSet class and implements Set interface It uses a mechanism hashing to store the elements HashSet<String> al= new HashSet();
  • 27. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Sets LinkedHashSet TreeSet HashSet Java.util.HashSet boolean add(Object c) boolean contains(Object o) Iterator iterator() Object clone() boolean isEmpty()void clear() int size() boolean remove(Object o)
  • 28. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Sets LinkedHashSet TreeSet HashSet Java LinkedHashSet class is a Hash table and Linked list implementation of the set interface It contains only unique elements It provides all optional set operations and maintains insertion order LinkedHashSet<String> al=new LinkedHashSet(); This class inherits methods from other classes AbstractCollection Object Set HashSet AbstractSet
  • 29. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Sets LinkedHashSet TreeSet HashSet TreeSet class implements the Set interface that uses a tree for storage The objects of this class are unique and are stored in the ascending order It inherits AbstractSet class and implements NavigableSet interface TreeSet<String> al=new TreeSet<String>();
  • 30. JAVA CERTIFICATION TRAINING www.edureka.co/java-j2ee-soa-training Java Sets LinkedHashSet TreeSet HashSet Java.util.TreeSet boolean addAll(Collection c) boolean contains(Object o) boolean isEmpty() Object last() int size() void clear()boolean remove(Object o) Object clone() Object first() void add(Object o)