您的位置:首页 > 编程语言 > Java开发

JDK源码之List

2016-03-28 17:14 344 查看
List<E> extends Collection<E>

1. Query Operation:

int size();

boolean isEmpty();

boolean contains(Object o);

Iterator<E> iterator();

Object[] toArray();

<T> T[] toArray(T[] a);

2. Modification Operations

boolean add(E e);

boolean remove(Object o);

3. Bulk Modification Operations

boolean containsAll(Collection<?> c);

boolean addAll(Collection<? extends E> c);

boolean addAll(int index, Collection<? extends E> c);

boolean removeAll(Collection<?> c);

boolean retainAll(Collection<?> c);

void clear();

4. Comparison and hashing

boolean equals(Object o);

int hashCode();

5. Positional Access Operations

E get(int index);

E set(int index, E element);

void add(int index, E element);

E remove(int index);

6. Search Operations

int indexOf(Object o);

int lastIndexOf(Object o);

7. List Iterators

ListIterator<E> listIterator();

ListIterator<E> listIterator(int index);

8. View

List<E> subList(int fromIndex, int toIndex);

===========================

ListIterator<E> extends Iterator<E>

1. Query Operations

boolean hasNext();

E next();

boolean hasPrevious();

E previous();

int nextIndex();

int previousIndex();

2. Modification Operations

void remove(); //Removes from the list the last element that was returned by next() or previous()

void set(E e); // Replaces the last element that was returned by next() or previous()

void add(E e); // Inserts the specified element into the list, The element is inserted immediately before the element that would be returned by next(), if any, and after the element that would be returned by previous(), if any.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: