WaitFor
package jdk8.byte_code; class WaitFor { static void waitFor(Condition condition) throws InterruptedException { while (!condition.isSatisfied()) Thread.sleep(250); } static <T> void waitFor(T input, Predicate<T> predicate) throws InterruptedException { while (!predicate.test(input)) Thread.sleep(250); } }