Untitled Document

Subscribe here to get updates on new Videos


19. LinkedList details?




previous homenext


1. The underlying data structure is Double LinkedList.
2. Insertion order is preserved.
3. Duplicates are allowed.
4. Heterogeneous Objects are allowed.
5. Null insertion is possible.
6. LinkedList implements Serializable and Clonable interfaces but not RandomAccess interface.
7. LinkedList is the best choice if our frequent operation is insertion or deletion in the middle.
8. LinkedList is the worst choice if our frequent operation is retrieval operation.
9. Usually we can use LinkedList to implement stacks and queues to provide support for this requirement LinkedList class defines following specific methods.

void addFirst();
void addLast();
Object getFirst();
Object getLast();
Object removeFirst();
Object removeLast();

LinkedList Constructors:

LinkedList l1=new LinkedList();
1. creates an empty LinkedList Object. LinkedList l1=new LinkedList(Collection c);
2. Creates an equivalent LinkedList Object for the given Collection.