SlideShare a Scribd company logo
Java Collections | Collections Framework in Java | Java Tutorial For Beginners | Edureka
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 (20)

collection framework in java
collection framework in javacollection framework in java
collection framework in java
MANOJ KUMAR
 
Collection Framework in java
Collection Framework in javaCollection Framework in java
Collection Framework in java
CPD INDIA
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
kumar gaurav
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
Minal Maniar
 
Collections framework in java
Collections framework in javaCollections framework in java
Collections framework in java
yugandhar vadlamudi
 
Java Collections Tutorials
Java Collections TutorialsJava Collections Tutorials
Java Collections Tutorials
Prof. Erwin Globio
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
Aneega
 
Collections - Array List
Collections - Array List Collections - Array List
Collections - Array List
Hitesh-Java
 
Arrays in java
Arrays in javaArrays in java
Arrays in java
Arzath Areeff
 
07 java collection
07 java collection07 java collection
07 java collection
Abhishek Khune
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - Java
Drishti Bhalla
 
Spring boot
Spring bootSpring boot
Spring boot
Gyanendra Yadav
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
slire
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
BG Java EE Course
 
Java Queue.pptx
Java Queue.pptxJava Queue.pptx
Java Queue.pptx
vishal choudhary
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
Naz Abdalla
 
Collections - Maps
Collections - Maps Collections - Maps
Collections - Maps
Hitesh-Java
 
Java - Collections framework
Java - Collections frameworkJava - Collections framework
Java - Collections framework
Riccardo Cardin
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 
Static Members-Java.pptx
Static Members-Java.pptxStatic Members-Java.pptx
Static Members-Java.pptx
ADDAGIRIVENKATARAVIC
 
collection framework in java
collection framework in javacollection framework in java
collection framework in java
MANOJ KUMAR
 
Collection Framework in java
Collection Framework in javaCollection Framework in java
Collection Framework in java
CPD INDIA
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
kumar gaurav
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
Minal Maniar
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
Aneega
 
Collections - Array List
Collections - Array List Collections - Array List
Collections - Array List
Hitesh-Java
 
Collections Api - Java
Collections Api - JavaCollections Api - Java
Collections Api - Java
Drishti Bhalla
 
Advance Java Topics (J2EE)
Advance Java Topics (J2EE)Advance Java Topics (J2EE)
Advance Java Topics (J2EE)
slire
 
Collections - Maps
Collections - Maps Collections - Maps
Collections - Maps
Hitesh-Java
 
Java - Collections framework
Java - Collections frameworkJava - Collections framework
Java - Collections framework
Riccardo Cardin
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 

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

java unit 4 pdf - about java collections
java unit 4 pdf - about java collectionsjava unit 4 pdf - about java collections
java unit 4 pdf - about java collections
aapalaks
 
Java Collections
Java  Collections Java  Collections
Java Collections
Kongu Engineering College, Perundurai, Erode
 
collectionsframework210616084411 (1).pptx
collectionsframework210616084411 (1).pptxcollectionsframework210616084411 (1).pptx
collectionsframework210616084411 (1).pptx
ArunPatrick2
 
oop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionoop lecture framework,list,maps,collection
oop lecture framework,list,maps,collection
ssuseredfbe9
 
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 Collection fundamentals and Uses Unit
Java Collection fundamentals and Uses UnitJava Collection fundamentals and Uses Unit
Java Collection fundamentals and Uses Unit
vinipant
 
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answeredU-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
zainmkhan20
 
Pptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
PptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfyPptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
Pptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
dnthulk
 
22CS305-UNIT-1.pptx ADVANCE JAVA PROGRAMMING
22CS305-UNIT-1.pptx   ADVANCE JAVA PROGRAMMING22CS305-UNIT-1.pptx   ADVANCE JAVA PROGRAMMING
22CS305-UNIT-1.pptx ADVANCE JAVA PROGRAMMING
logesswarisrinivasan
 
JAVA(UNIT 4)
JAVA(UNIT 4)JAVA(UNIT 4)
JAVA(UNIT 4)
Dr. SURBHI SAROHA
 
Collections lecture 35 40
Collections lecture 35 40Collections lecture 35 40
Collections lecture 35 40
bhawna sharma
 
11000121065_NAITIK CHATTERJEE.ppt
11000121065_NAITIK CHATTERJEE.ppt11000121065_NAITIK CHATTERJEE.ppt
11000121065_NAITIK CHATTERJEE.ppt
NaitikChatterjee
 
List interface in collections framework
List interface in collections frameworkList interface in collections framework
List interface in collections framework
Ravi Chythanya
 
collection framework.pptx
collection framework.pptxcollection framework.pptx
collection framework.pptx
SoniaKapoor56
 
module2a it is module 2 so it is module 2.pptx
module2a it is module 2 so it is module 2.pptxmodule2a it is module 2 so it is module 2.pptx
module2a it is module 2 so it is module 2.pptx
bharath555tth
 
Java Collection Framework
Java Collection FrameworkJava Collection Framework
Java Collection Framework
Lakshmi R
 
Collection v3
Collection v3Collection v3
Collection v3
Sunil OS
 
20CS305 Advance Java Programming Unit 1.ppt
20CS305 Advance Java Programming Unit 1.ppt20CS305 Advance Java Programming Unit 1.ppt
20CS305 Advance Java Programming Unit 1.ppt
logesswarisrinivasan
 
JavaCollections.ppt
JavaCollections.pptJavaCollections.ppt
JavaCollections.ppt
Irfanhabeeb18
 
JavaCollections.ppt
JavaCollections.pptJavaCollections.ppt
JavaCollections.ppt
boopathirajaraja1
 
java unit 4 pdf - about java collections
java unit 4 pdf - about java collectionsjava unit 4 pdf - about java collections
java unit 4 pdf - about java collections
aapalaks
 
collectionsframework210616084411 (1).pptx
collectionsframework210616084411 (1).pptxcollectionsframework210616084411 (1).pptx
collectionsframework210616084411 (1).pptx
ArunPatrick2
 
oop lecture framework,list,maps,collection
oop lecture framework,list,maps,collectionoop lecture framework,list,maps,collection
oop lecture framework,list,maps,collection
ssuseredfbe9
 
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 Collection fundamentals and Uses Unit
Java Collection fundamentals and Uses UnitJava Collection fundamentals and Uses Unit
Java Collection fundamentals and Uses Unit
vinipant
 
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answeredU-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
zainmkhan20
 
Pptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
PptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfyPptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
Pptchdtdtfygugyxthgihhihigugufydtdfzrzrzrtdyfyfy
dnthulk
 
22CS305-UNIT-1.pptx ADVANCE JAVA PROGRAMMING
22CS305-UNIT-1.pptx   ADVANCE JAVA PROGRAMMING22CS305-UNIT-1.pptx   ADVANCE JAVA PROGRAMMING
22CS305-UNIT-1.pptx ADVANCE JAVA PROGRAMMING
logesswarisrinivasan
 
Collections lecture 35 40
Collections lecture 35 40Collections lecture 35 40
Collections lecture 35 40
bhawna sharma
 
11000121065_NAITIK CHATTERJEE.ppt
11000121065_NAITIK CHATTERJEE.ppt11000121065_NAITIK CHATTERJEE.ppt
11000121065_NAITIK CHATTERJEE.ppt
NaitikChatterjee
 
List interface in collections framework
List interface in collections frameworkList interface in collections framework
List interface in collections framework
Ravi Chythanya
 
collection framework.pptx
collection framework.pptxcollection framework.pptx
collection framework.pptx
SoniaKapoor56
 
module2a it is module 2 so it is module 2.pptx
module2a it is module 2 so it is module 2.pptxmodule2a it is module 2 so it is module 2.pptx
module2a it is module 2 so it is module 2.pptx
bharath555tth
 
Java Collection Framework
Java Collection FrameworkJava Collection Framework
Java Collection Framework
Lakshmi R
 
Collection v3
Collection v3Collection v3
Collection v3
Sunil OS
 
20CS305 Advance Java Programming Unit 1.ppt
20CS305 Advance Java Programming Unit 1.ppt20CS305 Advance Java Programming Unit 1.ppt
20CS305 Advance Java Programming Unit 1.ppt
logesswarisrinivasan
 
Ad

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
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!
 
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!
 
Ad

Recently uploaded (20)

AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Oracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization ProgramOracle Cloud and AI Specialization Program
Oracle Cloud and AI Specialization Program
VICTOR MAESTRE RAMIREZ
 
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdfvertical-cnc-processing-centers-drillteq-v-200-en.pdf
vertical-cnc-processing-centers-drillteq-v-200-en.pdf
AmirStern2
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
The State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry ReportThe State of Web3 Industry- Industry Report
The State of Web3 Industry- Industry Report
Liveplex
 
How to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptxHow to Detect Outliers in IBM SPSS Statistics.pptx
How to Detect Outliers in IBM SPSS Statistics.pptx
Version 1 Analytics
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...
Safe Software
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfHow Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdf
Rejig Digital
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025Azure vs AWS  Which Cloud Platform Is Best for Your Business in 2025
Azure vs AWS Which Cloud Platform Is Best for Your Business in 2025
Infrassist Technologies Pvt. Ltd.
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 

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

  • 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)