Searching for "LinkedList"

Q:

How do you decide when to use ArrayList and When to use LinkedList?

Answer

If you need to support random access, without inserting or removing elements from any place other than the end, then ArrayList offers the optimal collection. If, however, you need to frequently add and remove elements from the middle of the list and only access the list elements sequentially, then LinkedList offers the better implementation.

Report Error

View answer Workspace Report Error Discuss

Subject: Java