boolean (Predicate<? super File> fileExists) { if (myResolved && !myStubbed) { long currentTime = System.currentTimeMillis(); if (myLastFileCheckTimeStamp + 2000 < currentTime) { // File.exists() is a slow operation, don't run it more than once a second if (!fileExists.test(myFile)) { return false; // Don't cache result if file is not exist. } myLastFileCheckTimeStamp = currentTime; } return true; } return false; }