Class StringSort
- java.lang.Object
-
- org.apache.jackrabbit.oak.commons.sort.StringSort
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Iterable<java.lang.String>
public class StringSort extends java.lang.Object implements java.lang.Iterable<java.lang.String>, java.io.CloseableUtility 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, java.util.Comparator<java.lang.String> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String id)voidclose()java.util.Iterator<java.lang.String>getIds()longgetSize()booleanisEmpty()java.util.Iterator<java.lang.String>iterator()voidsort()booleanusingFile()
-
-
-
Field Detail
-
BATCH_SIZE
public static final int BATCH_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
add
public void add(java.lang.String id) throws java.io.IOException- Throws:
java.io.IOException
-
sort
public void sort() throws java.io.IOException- Throws:
java.io.IOException
-
getIds
public java.util.Iterator<java.lang.String> getIds() throws java.io.IOException- Throws:
java.io.IOException
-
getSize
public long getSize()
-
isEmpty
public boolean isEmpty()
-
usingFile
public boolean usingFile()
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
iterator
public java.util.Iterator<java.lang.String> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.String>
-
-