E
- element typepublic class ArrayListBuffer<E> extends AbstractList<E> implements ListBuffer<E>, RandomAccess
ListBuffer
using an array.modCount
Constructor and Description |
---|
ArrayListBuffer()
Creates a new instance with default buffer size.
|
ArrayListBuffer(int bufferSize)
Creates a new instance with default buffer size.
|
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.
|
E |
get(int index) |
int |
getCursorPosition()
Returns the current cursor position.
|
boolean |
isExpandRequired()
Returns whether a new element object is required for the buffer or not.
|
void |
shrink()
Shrinks this buffer.
|
int |
size() |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArray
parallelStream, removeIf, stream
public ArrayListBuffer()
public ArrayListBuffer(int bufferSize)
bufferSize
- initial buffer size (number of objects)public void begin()
ListBuffer
ListBuffer.advance()
.
After changing the buffer, then clients must invoke ListBuffer.end()
and the buffer can be used as the
unmodifiable list.begin
in interface ListBuffer<E>
ListBuffer.advance()
public void end()
ListBuffer
ListBuffer.begin()
once more.end
in interface ListBuffer<E>
public int getCursorPosition()
begin()
and end()
, and it will return
the number of invoking advance()
since the last begin()
was invoked.advance()
public boolean isExpandRequired()
ListBuffer
ListBuffer.expand(Object)
to add a new object before invoke ListBuffer.advance()
.
This method must be invoked between ListBuffer.begin()
and ListBuffer.end()
.isExpandRequired
in interface ListBuffer<E>
true
if a new element object is required, otherwise false
ListBuffer.expand(Object)
public void expand(E value)
ListBuffer
ListBuffer.begin()
and ListBuffer.end()
.expand
in interface ListBuffer<E>
value
- the objectListBuffer.isExpandRequired()
,
ListBuffer.isExpandRequired()
public E advance()
ListBuffer
ListBuffer.begin()
and ListBuffer.end()
.advance
in interface ListBuffer<E>
ListBuffer.isExpandRequired()
,
ListBuffer.expand(Object)
public int size()
size
in interface Collection<E>
size
in interface List<E>
size
in class AbstractCollection<E>
public E get(int index)
public void shrink()
ListBuffer
shrink
in interface ListBuffer<E>
Copyright © 2011–2019 Asakusa Framework Team. All rights reserved.