Professional Documents
Culture Documents
Framework
• 3.14.1 CollectionFramework.
• 3.14.2 Interfaces: Collection, List, Set
• 3.14.3 Navigation: Enumeration, Iterator,
ListIterator
• 3.14.4 Classes: LinkedList, ArrayList, Vector,
HashSet
•
Java Collection Framework
Collection:
Collection Interface is implemented by all the classes
in the collection framework and declares the methods that
every collection will contain
Methods:
boolean add(object obj)
boolean addAll(object obj)
void clear()
List
Java List is an interface that extends the collection and
contains ordered collection of elements including
duplicate values. It stores elements in an index approach.
List
LinkedLis
ArrayList Vector
t
ArrayList:
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.
Syntax to create ArrayList
ArrayList<Type>arraylistNm=new ArrayList<>();
e.g.
ArrayList<String>a1=new ArrayList<>();
Note:
We can not create array lists of primitive data types like
int,float, char etc. Instead, we have to use their corresponding
wrapper class.
Important points of ArrayList