public static < T extends Collection > T untilEmpty ( Callable < T > callable , long timeout , TimeUnit unit ) { return SleepBuilder . < T > sleep ( ) . withComparer ( argument -> argument . isEmpty ( ) ) . withTimeout ( timeout , unit ) . withStatement ( callable ) . build ( ) ; }
Causes the current thread to wait until the callable is returning empty collection or the specified waiting time elapses .