|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
public interface AppendList<T>
Appendable list interface definition.
Two states are in this list. State AppendList.State.WRITE when instance created, then element can be append to tail.
After all elements are appended, switch state to AppendList.State.READ. When state is AppendList.State.READ, data cannot be
appended, only can be iterative.
Only support appending element to tail and iterative reading.
Such code as an example:
AppendList<Data> dataList = new MemoryDiskList<Data>(60L, "c.txt");
dataList.append(new Data(1, 1));
dataList.append(new Data(2, 2));
dataList.append(new Data(3, 3));
dataList.append(new Data(4, 4));
dataList.switchState();
for(Data d: dataList) {
System.out.println(d);
}
| 嵌套类摘要 | |
|---|---|
static class |
AppendList.State
Inner state definition. |
| 方法摘要 | |
|---|---|
boolean |
append(T t)
Append object to this list |
void |
clear()
Clear all elements. |
long |
size()
Return size of this list. |
void |
switchState()
After appending, switch state from WRITE to READ to allow iterating. |
| 从接口 java.lang.Iterable 继承的方法 |
|---|
iterator |
| 方法详细信息 |
|---|
boolean append(T t)
t - the object to append
IllegalStateException - if not in WRITE state.void switchState()
long size()
void clear()
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||