This is a simple utility class that aims to sort big Java object files that would otherwise not fit in memory.
The public static method "sort" should be used. It has 4 parameters:
- The file / path to the file to be sorted
- The name of the output sorted file
- The maximum number of objects we allow to be read in memory
- A comparator
A good maxObjReadInMemory would be equal to ceil(sqrt(2 * number_of_objects_in_input_file)) + 1
The program will split the original file into n small files that can fit in memory. Then, it will sort the contents of the files (according to a given comparator) using Shell Sort. Afterwards, it will merge the n sorted files into a single one using a Priority Queue.