Answers

Question and Answer:

  Home  Java Software Engineer

⟩ Can you give real world examples of when to use an ArrayList and when to use LinkedList?

ArrayList is preferred when there are more get(int), or when search operations need to be performed as every search operation runtime is O(1).

If an application requires more insert(int) and delete(int) operations, then LinkedList is preferred, as LinkedList does not need to maintain back and forth to preserve continued indices as arraylist does. Overall this question tests the proper usage of collections.

 190 views

More Questions for you: