U4-IT-Collection Framework and IO Stream in Java
U4-IT-Collection Framework and IO Stream in Java
&
I/O STREAM
1
COLLECTION FRAMEWORK IN JAVA
An array is an indexed collection of fixed no of homogeneous
data elements.
(or)
An array represents a group of elements of same data type.
The main advantage of array is we can represent huge no of
elements by using single variable. So that readability of the
code will be improved.
Example:
Student s[ ]=new Student[10000];
2
COLLECTION FRAMEWORK IN JAVA
Limitations of Array:
Arrays are fixed in size.
Arrays can hold only homogeneous data elements.
Arrays concept is not implemented based on some data
structure.
3
COLLECTION FRAMEWORK IN JAVA
The Collection in Java is a framework that provides
an architecture to store and manipulate the group of
objects.
The Java Collections Framework standardizes the way
in which groups of objects are handled by your
programs.
Collections were not part of the original Java release,
but Prior to the Collections Framework, Java provided
ad hoc classes such as Dictionary, Vector, Stack, and
Properties to store and manipulate groups of
objects. 4
COLLECTION FRAMEWORK IN JAVA
Early version of java did not include the Collections
support Generics. 5
COLLECTION FRAMEWORK IN JAVA
The following are the legacy classes defined by
java.util package.
Dictionary
HashTable
Properties
Stack
Vector
7
COLLECTION FRAMEWORK IN JAVA
8
COLLECTION FRAMEWORK IN JAVA
9
COLLECTION FRAMEWORK IN JAVA
10
COLLECTION FRAMEWORK IN JAVA
11
COLLECTION FRAMEWORK IN JAVA
12
COLLECTION FRAMEWORK IN JAVA
13
COLLECTION FRAMEWORK IN JAVA
14
COLLECTION FRAMEWORK IN JAVA
15
COLLECTION FRAMEWORK IN JAVA
16
COLLECTION FRAMEWORK IN JAVA
17
COLLECTION FRAMEWORK IN JAVA
18
COLLECTION FRAMEWORK IN JAVA
19
COLLECTION FRAMEWORK IN JAVA
20
COLLECTION FRAMEWORK IN JAVA
21
COLLECTION FRAMEWORK IN JAVA
22
COLLECTION FRAMEWORK IN JAVA
23
COLLECTION FRAMEWORK IN JAVA
24
COLLECTION FRAMEWORK IN JAVA
25
COLLECTION FRAMEWORK IN JAVA
26
COLLECTION FRAMEWORK IN JAVA
27
COLLECTION FRAMEWORK IN JAVA
Comparison of Set Implemented Class Objects.
28
COLLECTION FRAMEWORK IN JAVA
29
COLLECTION FRAMEWORK IN JAVA
30
COLLECTION FRAMEWORK IN JAVA
31
COLLECTION FRAMEWORK IN JAVA
32
COLLECTION FRAMEWORK IN JAVA
33
COLLECTION FRAMEWORK IN JAVA
34
COLLECTION FRAMEWORK IN JAVA
35
COLLECTION FRAMEWORK IN JAVA
36
COLLECTION FRAMEWORK IN JAVA
37
COLLECTION FRAMEWORK IN JAVA
38
COLLECTION FRAMEWORK IN JAVA
39
COLLECTION FRAMEWORK IN JAVA
40
COLLECTION FRAMEWORK IN JAVA
41
COLLECTION FRAMEWORK IN JAVA
42
COLLECTION FRAMEWORK IN JAVA
43
COLLECTION FRAMEWORK IN JAVA
44
COLLECTION FRAMEWORK IN JAVA
45
COLLECTION FRAMEWORK IN JAVA
46
COLLECTION FRAMEWORK IN JAVA
47
SCANNER CLASS IN JAVA
The Scanner class is used to get user input, and it is
found in the java.util package.
To use the Scanner class, create an object of the class
and use any of the available methods found in
the Scanner class documentation.
To import a class or a package:
49
STREAM CLASSES IN JAVA
Java’s stream-based I/O is built upon four abstract
classes: InputStream, OutputStream, Reader, and
Writer.
binary objects.
STREAM CLASSES IN JAVA
51
STREAM CLASSES IN JAVA
52
STREAM CLASSES IN JAVA
53
STREAM CLASSES IN JAVA
54
STREAM CLASSES IN JAVA
55
STREAM CLASSES IN JAVA
56
STREAM CLASSES IN JAVA
57
STREAM CLASSES IN JAVA
58
STREAM CLASSES IN JAVA
59
STREAM CLASSES IN JAVA
The FileReader class creates a Reader that you can use
to read the contents of a file.
FileReader(String filePath)
FileReader(File fileObj)
61
STREAM CLASSES IN JAVA
62
STREAM CLASSES IN JAVA
63
STREAM CLASSES IN JAVA
64
Thank You
65