private void processFreeEntries ( ) { // Get a reverse sorted list of free entries based on file offset (bigger entries will be ahead of smaller entries) // This helps to work backwards with free entries at end of the file List < FileEntry > l = new ArrayList <> ( freeList ) ; l . sort ( ( o1 , o2 ) -> { long diff = o1 . offset - o2 . offset ; return ( diff == 0 ) ? 0 : ( ( diff > 0 ) ? - 1 : 1 ) ; } ) ; truncateFile ( l ) ; mergeFreeEntries ( l ) ; }
Manipulates the free entries for optimizing disk space .