public class LinkedList<E> extends Object implements List<E>
| 构造器和说明 |
|---|
LinkedList() |
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(E e)
添加一个元素
|
void |
add(int index,
E element) |
boolean |
addAll(Collection<? extends E> c) |
boolean |
addAll(int index,
Collection<? extends E> c) |
void |
clear() |
boolean |
contains(Object o)
遍历整个链表,判断是否存在该元素
(1)二者不为空,且相等
(2)对象为 null,且链表中也有元素为 null
(3)如果链表为 null,直接返回 false。
|
boolean |
containsAll(Collection<?> c)
是否包含所有
(1)如果结合为 null,则认为不包含。
|
E |
get(int index) |
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
int |
lastIndexOf(Object o) |
ListIterator<E> |
listIterator() |
ListIterator<E> |
listIterator(int index) |
E |
remove(int index)
移除指定位置的元素
|
boolean |
remove(Object o)
移除一个元素
整体流程:从头开始遍历,对比二者的内容是否相同。
|
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
E |
set(int index,
E element) |
int |
size() |
List<E> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, hashCode, replaceAll, sort, spliteratorparallelStream, removeIf, streampublic boolean contains(Object o)
public boolean containsAll(Collection<?> c)
containsAll 在接口中 Collection<E>containsAll 在接口中 List<E>c - 集合public boolean add(E e)
public boolean remove(Object o)
public boolean addAll(Collection<? extends E> c)
public boolean addAll(int index,
Collection<? extends E> c)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public void add(int index,
E element)
public E remove(int index)
public int lastIndexOf(Object o)
lastIndexOf 在接口中 List<E>public ListIterator<E> listIterator()
listIterator 在接口中 List<E>public ListIterator<E> listIterator(int index)
listIterator 在接口中 List<E>Copyright © 2020. All rights reserved.