public class RoleList extends ArrayList<Object>
modCount| Constructor and Description |
|---|
RoleList()
构造一个空的RoleList。
|
RoleList(int initialCapacity)
构造一个空的RoleList,并指定初始容量。
|
RoleList(List<Role> list)
构造一个
RoleList含有的元素
List指定,在其中它们被返回的顺序
List的迭代器。
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index, Object element)
在此列表中的指定位置插入指定的元素。
|
void |
add(int index, Role role)
在指定的位置插入指定为元素的角色。
|
boolean |
add(Object o)
将指定的元素追加到此列表的末尾。
|
void |
add(Role role)
将指定的角色添加为列表的最后一个元素。
|
boolean |
addAll(Collection<?> c)
按指定集合的Iterator返回的顺序将指定集合中的所有元素追加到此列表的末尾。
|
boolean |
addAll(int index, Collection<?> c)
将指定集合中的所有元素插入到此列表中,从指定的位置开始。
|
boolean |
addAll(int index, RoleList roleList)
从指定的位置开始,按照指定的RoleList的迭代器返回的顺序,将指定的RoleList中的所有元素插入到此列表中。
|
boolean |
addAll(RoleList roleList)
将所指定的RoleList中的所有元素按指定的RoleList的迭代器返回的顺序附加到列表的末尾。
|
List<Role> |
asList()
返回此列表的视图为
List<Role> 。
|
Object |
set(int index, Object element)
用指定的元素替换此列表中指定位置的元素。
|
void |
set(int index, Role role)
将元素设置为指定的角色。
|
clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSizeequals, hashCodecontainsAll, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCodeparallelStream, streampublic RoleList()
public RoleList(int initialCapacity)
initialCapacity - 初始容量
public RoleList(List<Role> list) throws IllegalArgumentException
RoleList含有的元素List指定,在其中它们被返回的顺序List的迭代器。
RoleList实例的初始容量为List List大小的110%。
list -
List定义了新的
RoleList的初始内容。
IllegalArgumentException - 如果
list参数是
null或者如果
list参数包含任何非角色对象。
ArrayList.ArrayList(java.util.Collection)
public List<Role> asList()
List<Role> 。
返回值的更改反映在原始RoleList的更改中,反之亦然。
List<Role>的内容反映了这个RoleList的内容。
如果在给定的RoleList实例上调用了此方法,则后续尝试将对象添加到不是Role实例将失败,并带有IllegalArgumentException 。 出于兼容性考虑,一个RoleList上这种方法从未被称为确实允许比其他对象Role进行增补。
IllegalArgumentException - 如果这
RoleList包含不是
Role的元素。
public void add(Role role) throws IllegalArgumentException
role - 要添加的角色。
IllegalArgumentException - 如果角色为null。
public void add(int index,
Role role)
throws IllegalArgumentException,
IndexOutOfBoundsException
index - 要插入新Role对象的列表中的位置。
role - 要插入的角色对象。
IllegalArgumentException - 如果角色为null。
IndexOutOfBoundsException - 如果使用列表外的索引进行访问。
public void set(int index,
Role role)
throws IllegalArgumentException,
IndexOutOfBoundsException
index - 指定的位置。
role - 应该设置角色元素的值。
IllegalArgumentException - 如果角色为null。
IndexOutOfBoundsException - 如果使用列表外的索引进行访问。
public boolean addAll(RoleList roleList) throws IndexOutOfBoundsException
roleList - 要插入到列表中的元素(可以为null)
IndexOutOfBoundsException - 如果使用列表外的索引进行访问。
ArrayList.addAll(Collection)
public boolean addAll(int index,
RoleList roleList)
throws IllegalArgumentException,
IndexOutOfBoundsException
index - 从指定的RoleList插入第一个元素的位置。
roleList - 要插入列表的元素。
IllegalArgumentException - 如果角色为null。
IndexOutOfBoundsException - 如果使用列表外的索引进行访问。
ArrayList.addAll(int, Collection)
public boolean add(Object o)
ArrayList
add在界面
Collection<Object>
add在界面
List<Object>
add在
ArrayList<Object>
o - 要附加到此列表的元素
Collection.add(E)指定 )
public void add(int index,
Object element)
ArrayList
public boolean addAll(Collection<?> c)
ArrayList
addAll在界面
Collection<Object>
addAll在接口
List<Object>
addAll在
ArrayList<Object>
c - 包含要添加到此列表中的元素的集合
AbstractCollection.add(Object)
public boolean addAll(int index,
Collection<?> c)
ArrayList
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.