Linked List Flashcards

1
Q

Syntax

This method Inserts the specified element at the specified position in this list.

A

list.add​(int index, E element)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Syntax

This method Inserts all of the elements in the specified collection into this list, starting at the specified position.

A

list.addAll​(int index, Collection c)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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.

A

list.addAll​(Collection c)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Syntax

  1. This method Inserts the specified element at the beginning of this list.
  2. This method Appends the specified element to the end of this list.
A
  1. list.addFirst​(E e)

2. list.addLast​(E e)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Syntax

This method removes all of the elements from this list.

A

list.clear​()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Syntax

This method returns a shallow copy of this LinkedList

A

list.clone​()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Syntax

This method returns true if this list contains the specified element.

A

list.contains​(Object o)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Syntax

This method retrieves, but does not remove, the head (first element) of this list.

A

list.element​()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Syntax

This method returns the element at the specified position in this list.

A

list.get​(int index)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Syntax

  1. This method returns the first element in this list.
  2. This method returns the last element in this list.
A
  1. list.getFirst​()

2. list.getLast​()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

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.

A

list.indexOf​(Object o)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Syntax

  1. This method Inserts the specified element at the front of this list.
  2. This method Inserts the specified element at the end of this list.
A
  1. list.offerFirst​(E e)

2. list.offerLast​(E e)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Syntax

This method retrieves, but does not remove, the head (first element) of this list.

A

list. peek​()
list. peekFirst​()
list. peekLast​()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Syntax

This method retrieves and removes the head (first element) of this list.

A

list. poll()
list. pollFirst​():
list. pollLast​():

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Syntax

This method Pops an element from the stack represented by this list.

A

list.pop​()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Syntax

This method Pushes an element onto the stack represented by this list.

A

list.push​(E e)

17
Q

Syntax

This method retrieves and removes the head (first element) of this list.

A

list. remove​()
list. removeFirst​()
list. removeLast​()

18
Q

Syntax

This method replaces the element at the specified position in this list with the specified element.

A

list.set​(int index, E element)

19
Q

Syntax

This method returns the number of elements in this list.

A

list.size​()

20
Q

Syntax

This method returns an array containing all of the elements in this list in proper sequence (from first to last element)

A

list.toArray​()