Arraylist and Vector
Arraylist and Vector
Answer :
ArrayList:
Vector:
o Vector is synchronized.
o Vector is a legacy class.
o Vector increases its size by doubling the array size.
2. What Is The Difference Between Arraylist And Linkedlist?
Answer :
ArrayList:
LinkedList:
ListIterator:
Enumeration:
o Enumeration can traverse only legacy elements.
o Enumeration is not fail-fast.
o Enumeration is faster than Iterator.
5. What Is The Difference Between List And Set?
Answer :
List can contain duplicate elements whereas Set contains only unique elements.
6. What Is The Difference Between Hashset And Treeset?
Answer :
HashSet maintains no order whereas TreeSet maintains ascending order.
7. What Is The Difference Between Set And Map?
Answer :
Set contains values only whereas Map contains key and values both.
8. What Is The Difference Between Hashset And Hashmap?
Answer :
HashSet contains only values whereas HashMap contains entry(key,value). HashSet
can be iterated but HashMap need to convert into Set to be iterated
9. What Is The Difference Between Hashmap And Treemap?
Answer :
HashMap maintains no order but TreeMap maintains ascending order.
10. What Is The Difference Between Hashmap And Hashtable?
Answer :
HashMap:
Hashtable:
o Hashtable is synchronized.
o Hashtable cannot contain any null key or null value.
Comparator: