public class SortingLongCollection
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_ITEMS_IN_RAM |
static int |
SIZEOF |
Constructor and Description |
---|
SortingLongCollection(int maxValuesInRam,
java.io.File... tmpDir)
Prepare to accumulate values to be sorted
|
Modifier and Type | Method and Description |
---|---|
void |
add(long value)
Add a value to the collection.
|
void |
cleanup()
Delete any temporary files.
|
void |
doneAddingStartIteration()
This method must be called after done adding, and before calling hasNext() or next().
|
boolean |
hasNext()
Call only after doneAddingStartIteration() has been called.
|
long |
next()
Call only if hasNext() == true.
|
public static final int SIZEOF
public static final int MAX_ITEMS_IN_RAM
public SortingLongCollection(int maxValuesInRam, java.io.File... tmpDir)
maxValuesInRam
- how many values to accumulate before spilling to disktmpDir
- Where to write files of values that will not fit in RAMpublic void add(long value)
value
- public void doneAddingStartIteration()
public void cleanup()
public boolean hasNext()
public long next()