fix code snippet in closures in java