Linked List Flashcards
Syntax
This method Inserts the specified element at the specified position in this list.
list.add(int index, E element)
Syntax
This method Inserts all of the elements in the specified collection into this list, starting at the specified position.
list.addAll(int index, Collection c)
Syntax
This method Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection’s iterator.
list.addAll(Collection c)
Syntax
- This method Inserts the specified element at the beginning of this list.
- This method Appends the specified element to the end of this list.
- list.addFirst(E e)
2. list.addLast(E e)
Syntax
This method removes all of the elements from this list.
list.clear()
Syntax
This method returns a shallow copy of this LinkedList
list.clone()
Syntax
This method returns true if this list contains the specified element.
list.contains(Object o)
Syntax
This method retrieves, but does not remove, the head (first element) of this list.
list.element()
Syntax
This method returns the element at the specified position in this list.
list.get(int index)
Syntax
- This method returns the first element in this list.
- This method returns the last element in this list.
- list.getFirst()
2. list.getLast()
Syntax
This method returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
list.indexOf(Object o)
Syntax
- This method Inserts the specified element at the front of this list.
- This method Inserts the specified element at the end of this list.
- list.offerFirst(E e)
2. list.offerLast(E e)
Syntax
This method retrieves, but does not remove, the head (first element) of this list.
list. peek()
list. peekFirst()
list. peekLast()
Syntax
This method retrieves and removes the head (first element) of this list.
list. poll()
list. pollFirst():
list. pollLast():
Syntax
This method Pops an element from the stack represented by this list.
list.pop()