What's the main difference between ArrayList / HashMap and Vector / Hashtable? | Eklavya Online

What’s the main difference between ArrayList / HashMap and Vector / Hashtable?

Vector / HashTable are synchronized which means they are thread safe. Cost of thread safe is performance degradation. So if you are sure that you are not dealing with huge number of threads then you should use ArrayList / HashMap.But yes you can stillsynchronize List and Map’s using Collections provided methods :-

  • List OurList = Collections.synchronizedList (OurList);
  • Map OurMap = Collections.synchronizedMap (OurMap);