public File writeSortedChunk ( Iterator < T > input ) throws IOException { List < T > chunk = readChunk ( input ) ; return writeInternalSortedChunk ( chunk ) ; }
Read the data from the iterator then perform a sort and write a single sorted chunk file to disk . Note that a maximum of elements equal to the chunk size will be read from the iterator so make sure that the iterator contains no more than that . If that is the case then you may want to use the writeSortedChunks method instead .