Thursday, August 31, 2017

ArrayList vs. LinkedList vs. Vector


COLLECTION HIERARCHY



Performance of ArrayList vs. LinkedList
The time complexity comparison is as follows:
arraylist-vs-linkedlist-complexity
arraylist-vs-linkedlist
The difference of their performance is obvious. LinkedList is faster in add and remove, but slower in get. Based on the complexity table and testing results, we can figure out when to use ArrayList or LinkedList. In brief, LinkedList should be preferred if:
  • there are no large number of random access of element
  • there are a large number of add/remove operations
References

https://www.programcreek.com/2013/03/arraylist-vs-linkedlist-vs-vector/

No comments:

Post a Comment