question: private static < T , R > R accessSafely ( Lock lock , List < T > list , Function < List < T > , R > listFunction ) { final R returnValue ; lock . lock ( ) ; try { returnValue = listFunction . apply ( list ) ; } finally { lock . unlock ( ) ; } return returnValue ; }
target:  Locks the resource with the specified lock and performs the function. When the function is complete then the lock unlocked again.