Java Collections - Final
Java Collections - Final
SIVAKUMAR
B.Tech, M.Tech, MHRM, MBA, Ph.D
Professor, CSE
Puducherry Technological University
1
2
3
CSEB.26@PTUNIV.EDU.IN
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Hierarchy
of
Collection
Framework
18
Sorting
• Comparable Interface • Comparator Interface
• Default nature of sorting order • Customized sorting order
19
20
Cursors
• Enumerations • Iterator • ListIterator
21
Collection in Java
• Any group of individual objects which are represented as a single unit is
known as the collection of the objects.
• The Collection interface (java.util.Collection) and Map interface
(java.util.Map) are the two main “root” interfaces of Java collection
classes.
22
23
24
25
26
27
Java ArrayList
28
29
30
31
32
33
• Java LinkedList class uses a doubly linked list to
store the elements. It provides a linked-list data
structure.
• It inherits the AbstractList class and implements
List and Deque interfaces.
• The important points about Java LinkedList are:
Java • Java LinkedList class can contain duplicate
LinkedList elements.
• Java LinkedList class maintains insertion order.
class • Java LinkedList class is non synchronized.
• In Java LinkedList class, manipulation is fast
because no shifting needs to occur.
• Java LinkedList class can be used as a list, stack
or queue.
34
35
36
Java LinkedList example to add elements
37
Java LinkedList example to remove elements
38
Java LinkedList Example to reverse a list of
elements
39
Difference Between ArrayList and LinkedList
40
Example of ArrayList and LinkedList in
Java
41
42
43
Java HashSet Example
44
Java HashSet example ignoring duplicate elements
45
Java HashSet example to remove elements
46
Java HashSet from another Collection
47
48
49
Java TreeMap Example: remove()
50
Java TreeMap Example:
NavigableMap
51
Java Vector
52
53
54
55
JDBC Driver
JDBC Driver is a software component that enables java application to
interact with the database. There are 4 types of JDBC drivers:
1. JDBC-ODBC bridge driver
2. Native-API driver (partially java driver)
3. Network Protocol driver (fully java driver)
4. Thin driver (fully java driver)
56
57
58
59
60
Multithreading
• Multithreading in Java is a process of executing multiple threads
simultaneously.
• A thread is a lightweight sub-process, the smallest unit of processing.
• Java Multithreading is mostly used in games, animation, etc.
61
Thread in java
• A thread is a lightweight
subprocess, the smallest unit
of processing. It is a separate
path of execution.
66