title: wait x seconds or until a condition becomes true
body: <p>How to wait x seconds or until a condition becomes true? The condition should be tested periodically while waiting. Currently I'm using this code, but there should be a short function.</p>
  
  <pre><code>for (int i = 10; i &gt; 0 &amp;&amp; !condition(); i--) {
      Thread.sleep(1000);
  }
  </code></pre>