Class StringSort
- java.lang.Object
-
- org.apache.jackrabbit.oak.commons.sort.StringSort
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<String>
public class StringSort extends Object implements Iterable<String>, Closeable
Utility class to store a list of string and perform sort on that. For small size the list would be maintained in memory. If the size crosses the required threshold then the sorting would be performed externally
-
-
Field Summary
Fields Modifier and Type Field Description static intBATCH_SIZE
-
Constructor Summary
Constructors Constructor Description StringSort(int overflowToDiskThreshold, Comparator<String> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String id)voidclose()Iterator<String>getIds()longgetSize()booleanisEmpty()Iterator<String>iterator()voidsort()booleanusingFile()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
BATCH_SIZE
public static final int BATCH_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StringSort
public StringSort(int overflowToDiskThreshold, Comparator<String> comparator)
-
-
Method Detail
-
add
public void add(String id) throws IOException
- Throws:
IOException
-
sort
public void sort() throws IOException- Throws:
IOException
-
getIds
public Iterator<String> getIds() throws IOException
- Throws:
IOException
-
getSize
public long getSize()
-
isEmpty
public boolean isEmpty()
-
usingFile
public boolean usingFile()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-