question: private int removeNext ( ) { if ( lastUsageDates . isEmpty ( ) ) { return INVALID_SIZE ; } Long oldestUsage = null ; File mostLongUsedFile = null ; Set < Entry < File , Long > > entries = lastUsageDates . entrySet ( ) ; synchronized ( lastUsageDates ) { for ( Entry < File , Long > entry : entries ) { if ( mostLongUsedFile == null ) { mostLongUsedFile = entry . getKey ( ) ; oldestUsage = entry . getValue ( ) ; } else { Long lastValueUsage = entry . getValue ( ) ; if ( lastValueUsage < oldestUsage ) { oldestUsage = lastValueUsage ; mostLongUsedFile = entry . getKey ( ) ; } } } } int fileSize = 0 ; if ( mostLongUsedFile != null ) { if ( mostLongUsedFile . exists ( ) ) { fileSize = getSize ( mostLongUsedFile ) ; if ( mostLongUsedFile . delete ( ) ) { lastUsageDates . remove ( mostLongUsedFile ) ; } } else { lastUsageDates . remove ( mostLongUsedFile ) ; } } return fileSize ; }
target:  Remove next file and returns it's size 