您的位置:首页 > 移动开发 > Android开发

【Android API】java.util.List<E>

2015-01-28 19:39 309 查看
java.util.List<E>

属于公共接口,因此List<String> list = new List<String>();是无法实例化的。

已知间接子类:

AbstractList
<E>,
AbstractSequentialList <E>,
ArrayList <E>,
CopyOnWriteArrayList <E>,
LinkedList <E>,
Stack <E>,
Vector <E> 可以通过这些类来实例化。比如:

List<String> list = new ArrayList<String>();

Public Methods
abstract booleanadd(E object)
Adds the specified object at the end of this
List
.
abstract voidadd(int location, E object)
Inserts the specified object into this
List
at the specified location.
abstract booleanaddAll(Collection<? extends E>
collection)
Adds the objects in the specified collection to the end of this
List
.
abstract booleanaddAll(int
location,
Collection<? extends E> collection)
Inserts the objects in the specified collection at the specified location in this
List
.
abstract voidclear()
Removes all elements from this
List
, leaving it empty.
abstract booleancontains(Object
object)
Tests whether this
List
contains the specified object.
abstract booleancontainsAll(Collection<?>
collection)
Tests whether this
List
contains all objects contained in the specified collection.
abstract booleanequals(Object
object)
Compares the given object with the
List
, and returns true if they represent the same object using a class specific comparison.
abstract Eget(int location)
Returns the element at the specified location in this
List
.
abstract inthashCode()
Returns the hash code for this
List
.
abstract intindexOf(Object
object)
Searches this
List
for the specified object and returns the index of the first occurrence.
abstract booleanisEmpty()
Returns whether this
List
contains no elements.
abstract

Iterator<E>
iterator()
Returns an iterator on the elements of this
List
.
abstract intlastIndexOf(Object
object)
Searches this
List
for the specified object and returns the index of the last occurrence.
abstract

ListIterator<E>
listIterator(int location)
Returns a list iterator on the elements of this
List
.
abstract

ListIterator<E>
listIterator()
Returns a
List
iterator on the elements of this
List
.
abstract Eremove(int location)
Removes the object at the specified location from this
List
.
abstract booleanremove(Object
object)
Removes the first occurrence of the specified object from this
List
.
abstract booleanremoveAll(Collection<?>
collection)
Removes all occurrences in this
List
of each object in the specified collection.
abstract booleanretainAll(Collection<?>
collection)
Removes all objects from this
List
that are not contained in the specified collection.
abstract Eset(int location, E object)
Replaces the element at the specified location in this
List
with the specified object.
abstract intsize()
Returns the number of elements in this
List
.
abstract

List<E>
subList(int start,
int end)
Returns a
List
of the specified portion of this
List
from the given start index to the end index minus one.
abstract <T> T[]%29]toArray(T[] array)
Returns an array containing all elements contained in this
List
.
abstract

Object[]
toArray()
Returns an array containing all elements contained in this
List
.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: