Collection Final Grooming
Collection Final Grooming
What is Collection?
○ It Represent Collection of Objects
What is FrameWork or Collection FrameWork?
○ It is a ready made architecture to perform Crud operation on Collection by using Built-in
Methods.
What is Collection Hirarachy?
○ It is the combination of built in classes and interface with predefined Methods to perform
Crud operation on Collection
ArrayList
****************************************************************************************
TreeSet
Map
What is Map?
○ It is a Datastr Where we store the Data in key-value Pair
○ Map Hierrarchy
HashMap
HashMap is a map based collection which is used to store entries , and it is a implementation
class of Map interface.
Present since JDK 1.2.
HashMap is hash based , Hence the internal data structure is HashTable.
Initial capacity of HashMap is 16.
Fill ratio or load factor is 75%
HashMap can store single null key.
HashMap can store heterogeneous data and does not maintain any insertion order.
****************************************************************************************
TreeMap
****************************************************************************************
HashTable
Hashtable is one of the implementation class of Map interface.
Present since JDK 1.0 [legacy class].
It is also a hash based collection , hence data structure used is HashTable.
Hashtable is Single threaded. i.e.., methods are synchronized.
Initial capacity is 11.
Load factor or fill ratio is 75%.
Hashtable cannot store even a single null key.
Hashtable is slower than HashMap. Because it is Single threaded.
There are 4 overloaded constructor present in Hashtable
****************************************************************************************