T - public abstract class ArrayBase<T>
extends java.lang.Object
implements java.util.RandomAccess, java.io.Serializable, java.lang.Cloneable, java.util.Iterator<T>, java.lang.Iterable<T>
| 限定符和类型 | 字段和说明 |
|---|---|
protected T[] |
elements
记录列表
|
protected int |
pos
Iterator中的指针
|
protected int |
size
记录大小
|
| 构造器和说明 |
|---|
ArrayBase() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(int index,
T record) |
boolean |
add(T record)
增加记录
|
boolean |
add(T[] record) |
void |
clear()
清空数组
|
java.lang.Object |
clone()
复制记录
|
static <T> T[] |
collection2Array(java.util.Collection<T> collection) |
boolean |
contains(T elem)
判断数据是否存在
|
protected void |
ensureCapacity(int minCapacity)
扩展空间,不支持多线程
|
T |
get(int index)
取指定的记录
|
boolean |
hasNext()
Check to see if there is another element in the array.
|
int |
indexOf(T elem)
查找数据
|
boolean |
isEmpty()
判断是否空
|
java.util.Iterator<T> |
iterator() |
int |
lastIndexOf(T elem)
从数组的末尾开始查找数据是否存在
|
protected abstract T[] |
makeArray(int len)
生成数组
|
T |
next()
Move to next element in the array.
|
protected void |
rangeCheck(int index)
检查是否越界
|
void |
remove()
删除当前数据
|
T |
remove(int index)
删除记录
|
void |
remove(T record)
删除指定的记录
|
protected void |
removeRange(int fromIndex,
int toIndex)
移动块
|
T |
set(int index,
T element)
设置内容
|
void |
setPosition(int pos) |
int |
size()
取记录数量
|
T[] |
toArray() |
T[] |
toArray(T[] a)
生成数组
|
void |
trimToSize()
压缩空间
|
protected int size
protected transient T[] elements
protected int pos
protected abstract T[] makeArray(int len)
len - public T[] toArray()
public T get(int index)
index - public boolean add(T record)
record - public boolean add(T[] record)
public void add(int index,
T record)
public T remove(int index)
index - public void remove(T record)
record - public int size()
public boolean isEmpty()
public boolean contains(T elem)
elem - public int indexOf(T elem)
elem - public int lastIndexOf(T elem)
elem - protected void removeRange(int fromIndex,
int toIndex)
fromIndex - toIndex - public void trimToSize()
public java.lang.Object clone()
clone 在类中 java.lang.Objectpublic void clear()
protected void rangeCheck(int index)
index - protected void ensureCapacity(int minCapacity)
minCapacity - public void setPosition(int pos)
public T next()
next 在接口中 java.util.Iterator<T>public boolean hasNext()
hasNext 在接口中 java.util.Iterator<T>public void remove()
remove 在接口中 java.util.Iterator<T>public static <T> T[] collection2Array(java.util.Collection<T> collection)