E - the element typepublic interface ListBuffer<E> extends List<E>
Iterator<Hoge> iter = ...;
ListBuffer<Hoge> hoges = ...;
...
hoges.begin();
while (iter.hasNext()) {
Hoge hoge = iter.next();
if (hoges.isExpandRequired()) {
hoges.expand(new Hoge());
}
hoges.advance().set(hoge);
}
hoges.end();
// use hoges as List
hoges.shrink();
| Modifier and Type | Method and Description |
|---|---|
E |
advance()
Returns the next element object on the internal cursor, and then move the cursor to the next element.
|
void |
begin()
Begins changing the list buffer.
|
void |
end()
Ends changing the list buffer.
|
void |
expand(E value)
Adds a new element object into the tail of this buffer.
|
boolean |
isExpandRequired()
Returns whether a new element object is required for the buffer or not.
|
void |
shrink()
Shrinks this buffer.
|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArrayparallelStream, removeIf, streamvoid begin()
advance().
After changing the buffer, then clients must invoke end() and the buffer can be used as the
unmodifiable list.BufferException - if failed to prepare bufferadvance()void end()
begin() once more.BufferException - if failed to prepare bufferboolean isExpandRequired()
expand(Object) to add a new object before invoke advance().
This method must be invoked between begin() and end().true if a new element object is required, otherwise falseBufferException - if failed to prepare bufferexpand(Object)void expand(E value)
begin() and end().value - the objectIndexOutOfBoundsException - if expand is not required (optional operation)BufferException - if failed to prepare bufferisExpandRequired(),
isExpandRequired()E advance()
begin() and end().IndexOutOfBoundsException - if the next element object is not preparedBufferException - if failed to prepare bufferisExpandRequired(),
expand(Object)void shrink()
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.