What is the difference between HashTable and ArrayList?
Pradeep Shet
1) HashTable is a collection of objects which store values based on key where as ArrayList is just a collection of objects stored based on index 2) Retrieving value from HashTable is faster as it is linked with key whereas it is difficult in case of ArrayList value is fetched with index 3) HastTable is used for maintaining huge data
Following are the main differences Array List 1.Array List is a List 2.In this we can only add items to the list 3.Here we Can Add any datatype value,Every item in arraylist is treated as object Hash Table 1.Hash Table is a map 2.Here we can add data with the key 3.Retrieving by key in Hashtable is faster than retrieving in Arraylist
Array list is a list where we can add items Hash table is a map, key value pairs
An ArrayList is a dynamic array that grows as new items are added that go beyond the current capacity of the list. Items in ArrayList are accessed by index, much like an array.The Hashtable data structure is typically an array but instead of accessing via an index, you access via a key field which maps to a location in the hashtable by calling the key object's GetHashCode() method.In general, ArrayList and Hashtable are discouraged in .NET 2.0 and above in favor of List and Dictionary which are much better generic versions that perform better and don't have boxing costs for value types