boolean (final boolean emptiness) { final Ref<Boolean> resultRef = new Ref<>(Boolean.FALSE); myCachesHolder.iterateAllCaches(changesCacheFile -> { try { if (changesCacheFile.isEmpty() == emptiness) { resultRef.set(true); return false; } } catch (IOException e) { LOG.info(e); } return true; }); return resultRef.get(); }