P.1
Arrays & Java Collections Framework
ghadeer-al-hasan ghadeerof@gamil.com
Array Example: P.2
Array Example: P.3
Array Example: P.4
 In Java all array are object
Array Initialization: P.5
Object Array: P.6
Copy Arrays: P.7
Example Parameters : P.8
Arrays Parameters: P.9
Arrays Parameters: P.10
Arrays Parameters: P.11
Arrays Parameters: P.12
Private Arrays: P.13
For primitive data type we can use clone method, but for complex type we need
deep copy; override clone.
Multidimensional Arrays: P.14
Collections: P.15
 Is a framework that provides an architecture to store and manipulate the
group of objects.
Framework in Java:
• Provide readymade architecture.
• Represents set of classes and interface.
• Is optional.
Iterator Interface: P.16
 Iterator interface provides the facility of iterating the elements in forward
direction only.
Methods of Iterator interface:
There are only three methods in the Iterator interface.
1. Public Boolean hasNext(): is returns true if iterator has more elements.
2. Public object next(): is returns the element and moves the cursor pointer to the next
element.
3. Public void remove(): it removes the last elements returned by the iterator.
ArrayList Class: P.17
ArrayList Cont. : P.18
ArrayList Cont. : P.19
ArrayList Methods: P.20
ArrayList Methods: P.21
TreeSet Class: P.22
Map Interface P.23
 It contains values based on the key,
 Key and value pair.
 Each pair is know as an entry.
 It contains only unique elements.
Entry:
 It is the subinterface of Map.
 It provides methods to get key and value.
TreeMap class: P.24
 It contains values on the key.
 It contains only unique elements.
 It cannot have null key can have multiple null values.
 It maintains ascending order
Sorting : P.25
 We can sort the elements of:
 String object.
 Wrapper class objects.
 User-defined class objects.
Sorting Cont. : P.26
Stack class : P.27
The End
ghadeer-al-hasan ghadeerof@gamil.com

#6- Arrays and Collections Framework