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

JDK源码阅读之List接口

2015-09-16 11:47 399 查看

JDK源码阅读之List接口

package java.util;

/**
* @author  Josh Bloch
* @author  Neal Gafter
* @since 1.2
*/

public interface List<E> extends Collection<E> {
// Query Operations
int size();
boolean isEmpty();
boolean contains(Object o);
Iterator<E> iterator();
Object[] toArray();
<T> T[] toArray(T[] a);

// Modification Operations
boolean add(E e);
boolean remove(Object o);

// 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();

// Comparison and hashing
boolean equals(Object o);
int hashCode();

// Positional Access Operations
E get(int index);
E set(int index, E element);
void add(int index, E element);
E remove(int index);

// Search Operations
//首次出现
int indexOf(Object o);

//末尾出现
int lastIndexOf(Object o);

// List Iterators
ListIterator<E> listIterator();
ListIterator<E> listIterator(int index);

// View
List<E> subList(int fromIndex, int toIndex);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: