public abstract class LazyList<E>
extends java.util.AbstractList<E>
calculateSize and
fillChunk.| Constructor and Description |
|---|
LazyList()
Creates a new lazy list with chunkSize=10 and chunkOffset=0.
|
LazyList(int chunkSize)
Creates a new lazy list with a given chunkSize and chunkOffset=0.
|
LazyList(int chunkSize,
int chunkOffset)
Creates a new lazy list with a given chunkSize and chunkOffset.
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract int |
calculateSize()
Implement this method to calculate the total size of this list.
|
protected abstract void |
fillChunk(int start,
int length)
Implement this method to load a range of lazy loaded objects.
|
E |
get(int index) |
float |
getGrowFactor() |
int |
getShrinkThreshold() |
E |
set(int index,
E o)
Sets a cached object.
|
void |
setChunkParams(int size,
int offset)
Sets the chunk parameters.
|
void |
setGrowFactor(float growFactor) |
void |
setShrinkThreshold(int shrinkThreshold) |
protected void |
setSize(int newSize)
An implementing class can update the size of this list any time
(e.g. if the size of a result set changed).
|
int |
size() |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitpublic LazyList()
public LazyList(int chunkSize)
chunkSize - Size of a lazy loaded chunk.public LazyList(int chunkSize,
int chunkOffset)
chunkSize - Size of a lazy loaded chunk.chunkOffset - Offset of a lazy loaded chunk, must be 0 or negative.public final E get(int index)
public final int size()
public void setChunkParams(int size,
int offset)
size - Size of a lazy loaded chunk.offset - Offset of a lazy loaded chunk, must be 0 or negative.java.lang.IllegalArgumentExceptionpublic float getGrowFactor()
public void setGrowFactor(float growFactor)
public int getShrinkThreshold()
public void setShrinkThreshold(int shrinkThreshold)
protected void setSize(int newSize)
newSize - protected abstract int calculateSize()
protected abstract void fillChunk(int start,
int length)
set(int i, Object o) method to set a
loaded object.start - Start offsetlength - Chunk length© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.