NonGenericList
Inheritance: java.lang.Object
All Implemented Interfaces: java.util.List
public class NonGenericList implements List
非泛型对象列表
构造函数
| 构造函数 | 描述 |
|---|---|
| NonGenericList(List list) | 初始化 NonGenericList 类的新实例。 |
方法
| 方法 | 描述 |
|---|---|
| getList() | |
| addItem(Object value) | 向 System.Collections.IList 添加一个项。 |
| clear() | 从 System.Collections.IList 中移除所有项。 |
| contains(Object value) | 确定 System.Collections.IList 是否包含特定值。 |
| indexOf(Object value) | 确定 System.Collections.IList 中特定项的索引。 |
| insertItem(int index, Object value) | 在指定索引处向 System.Collections.IList 插入项。 |
| get(int index) | 获取指定索引处的元素。 |
| set(int index, Object value) | 设置指定索引处的元素。 |
| removeItem(Object value) | 从 System.Collections.IList 中移除特定对象的首次出现。 |
| removeAt(int index) | 移除指定索引处的 System.Collections.IList 项。 |
| size() | 获取 System.Collections.ICollection 中包含的元素数量。 |
| isEmpty() | |
| toArray() | |
| add(Object o) | |
| remove(Object o) | |
| containsAll(Collection c) | |
| addAll(Collection c) | |
| addAll(int index, Collection c) | |
| removeAll(Collection c) | |
| retainAll(Collection c) | |
| add(int index, Object element) | |
| remove(int index) | |
| lastIndexOf(Object o) | |
| listIterator() | |
| listIterator(int index) | |
| subList(int fromIndex, int toIndex) | |
| iterator() | 返回一个遍历集合的枚举器。 |
| toArray(Object[] a) |
NonGenericList(List list)
public NonGenericList(List list)
初始化 NonGenericList 类的新实例。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 列表 | java.util.List | 列表 - 对象的容器。 |
getList()
public List getList()
Returns: java.util.List
addItem(Object value)
public int addItem(Object value)
向 System.Collections.IList 添加一个项。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | java.lang.Object | 要添加到 System.Collections.IList 的 System.Object。 |
Returns: int - 新元素被插入的位置。
clear()
public void clear()
从 System.Collections.IList 中移除所有项。
contains(Object value)
public boolean contains(Object value)
确定 System.Collections.IList 是否包含特定值。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | java.lang.Object | 要在 System.Collections.IList 中定位的 System.Object。 |
Returns:
boolean - 如果在 System.Collections.IList 中找到 System.Object 则为 true;否则为 false。
indexOf(Object value)
public int indexOf(Object value)
确定 System.Collections.IList 中特定项的索引。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | java.lang.Object | 要在 System.Collections.IList 中定位的 System.Object。 |
Returns:
int - 如果在列表中找到 value,则返回其索引;否则返回 -1。
insertItem(int index, Object value)
public void insertItem(int index, Object value)
在指定索引处向 System.Collections.IList 插入项。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| index | int | 应插入 value 的零基索引。 |
| value | java.lang.Object | 要插入到 System.Collections.IList 的 System.Object。 |
get(int index)
public Object get(int index)
获取指定索引处的元素。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| index | int | 索引。 |
Returns: java.lang.Object - 指定索引处的元素。
set(int index, Object value)
public Object set(int index, Object value)
设置指定索引处的元素。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| index | int | 索引。 |
| value | java.lang.Object |
Returns: java.lang.Object
removeItem(Object value)
public void removeItem(Object value)
从 System.Collections.IList 中移除特定对象的首次出现。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| value | java.lang.Object | 要从 System.Collections.IList 中移除的 System.Object。 |
removeAt(int index)
public void removeAt(int index)
移除指定索引处的 System.Collections.IList 项。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| index | int | 要移除的项的零基索引。 |
size()
public int size()
获取 System.Collections.ICollection 中包含的元素数量。
Returns: int
isEmpty()
public boolean isEmpty()
Returns: boolean
toArray()
public Object[] toArray()
Returns: java.lang.Object[]
add(Object o)
public boolean add(Object o)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| o | java.lang.Object |
Returns: boolean
remove(Object o)
public boolean remove(Object o)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| o | java.lang.Object |
Returns: boolean
containsAll(Collection c)
public boolean containsAll(Collection c)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| c | java.util.Collection |
Returns: boolean
addAll(Collection c)
public boolean addAll(Collection c)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| c | java.util.Collection |
Returns: boolean
addAll(int index, Collection c)
public boolean addAll(int index, Collection c)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| index | int | |
| c | java.util.Collection |
Returns: boolean
removeAll(Collection c)
public boolean removeAll(Collection c)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| c | java.util.Collection |
Returns: boolean
retainAll(Collection c)
public boolean retainAll(Collection c)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| c | java.util.Collection |
Returns: boolean
add(int index, Object element)
public void add(int index, Object element)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| index | int | |
| 元素 | java.lang.Object |
remove(int index)
public Object remove(int index)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| index | int |
Returns: java.lang.Object
lastIndexOf(Object o)
public int lastIndexOf(Object o)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| o | java.lang.Object |
Returns: int
listIterator()
public ListIterator<Object> listIterator()
Returns: java.util.ListIterator<java.lang.Object>
listIterator(int index)
public ListIterator<Object> listIterator(int index)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| index | int |
Returns: java.util.ListIterator<java.lang.Object>
subList(int fromIndex, int toIndex)
public List<Object> subList(int fromIndex, int toIndex)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| fromIndex | int | |
| toIndex | int |
Returns: java.util.List<java.lang.Object>
iterator()
public Iterator iterator()
返回一个遍历集合的枚举器。
Returns:
java.util.Iterator - 一个 System.Collections.IEnumerator 对象,可用于遍历集合。
toArray(Object[] a)
public Object[] toArray(Object[] a)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 一个 | java.lang.Object[] |
Returns: java.lang.Object[]