In Exercise 2, second paragraph states ...

There are two general-purpose List implementations in the Collections
Framework: ArrayList and LinkedList. Which of the two List
implementations you use depends on your specific needs. If you need to
support random access, with 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.

My confusion is this ...

A) If ... inserting or removing ... any place other than the end, then
ArrayList offers the optimal collection.

"any place other than the end" - This means adding and removing from
the middle of the List.  Correct?

B) If, however, ... add and remove elements from the middle ... then
LinkedList offers the better implementation.

"add and remove elements from the middle" - This also means adding and
removing from the middle of the List.  Correct?

But as stated from JavaDoc of the LinkedList (http://
download.oracle.com/javase/1.5.0/docs/api/index.html?java/util/
ArrayList.html), which notes "remove and insert an element at the
beginning and end of the list"

Linked list implementation of the List interface. Implements all
optional list operations, and permits all elements (including null).
In addition to implementing the List interface, the LinkedList class
provides uniformly named methods to get, remove and insert an element
at the beginning and end of the list. These operations allow linked
lists to be used as a stack, queue, or double-ended queue (deque).


Please advise.

-- 
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to