E
- - A Serializable Classpublic class DiskQueue<E extends java.io.Serializable>
extends java.util.AbstractQueue<java.lang.String>
implements java.lang.AutoCloseable
Constructor and Description |
---|
DiskQueue(int maxInMemorySize)
Construct a disk-backed queue that keeps at most
maxInMemorySize elements in memory. |
DiskQueue(int maxInMemorySize,
java.io.File tempDir)
Construct a disk-backed queue that keeps at most
maxInMemorySize elements in memory. |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
close() |
java.util.Iterator<java.lang.String> |
iterator() |
boolean |
offer(java.lang.String element) |
java.lang.String |
peek() |
java.lang.String |
poll() |
java.lang.String |
remove() |
int |
size() |
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public DiskQueue(int maxInMemorySize)
maxInMemorySize
elements in memory.maxInMemorySize
- Maximum number of elements to keep in memory.public DiskQueue(int maxInMemorySize, java.io.File tempDir)
maxInMemorySize
elements in memory.maxInMemorySize
- Maximum number of elements to keep in memory.tempDir
- Directory where queue temporary files will be written to.public void close()
close
in interface java.lang.AutoCloseable
public java.util.Iterator<java.lang.String> iterator()
iterator
in interface java.lang.Iterable<java.lang.String>
iterator
in interface java.util.Collection<java.lang.String>
iterator
in class java.util.AbstractCollection<java.lang.String>
public int size()
size
in interface java.util.Collection<java.lang.String>
size
in class java.util.AbstractCollection<java.lang.String>
public boolean offer(java.lang.String element)
offer
in interface java.util.Queue<java.lang.String>
public java.lang.String peek()
peek
in interface java.util.Queue<java.lang.String>
public java.lang.String remove()
remove
in interface java.util.Queue<java.lang.String>
remove
in class java.util.AbstractQueue<java.lang.String>
public java.lang.String poll()
poll
in interface java.util.Queue<java.lang.String>
public void clear()
clear
in interface java.util.Collection<java.lang.String>
clear
in class java.util.AbstractQueue<java.lang.String>