title: Are negative timeouts safe with Future.get(long, TimeUnit)?
body: <p>Is it safe to supply a negative timeout to <code>java.util.concurrent.Future.get(long, TimeUnit)</code>? The documentation says</p>
  
  <blockquote>
    <p>Waits if necessary for at most the given time for the computation to complete, and then retrieves its result, if available.</p>
  </blockquote>
  
  <p>Does this imply that it will work with negative values, or does this statement only cover the non-negative cases? The behaviour I would expect would be to return the result if it is available or timeout immediately otherwise. This situation may occur, if we want to calculate the timeout for an absolute point in time and this has already passed. Of course I can use <code>max{timeout, 0}</code>, but is this really necessary? Tests in my enviroment showed it worked, but is this guaranteed? <a href="https://stackoverflow.com/questions/9332904/behavior-of-future-get-with-0-timeout">https://stackoverflow.com/questions/9332904/behavior-of-future-get-with-0-timeout</a> states that this should be the case for a 0 timeout.</p>
  
  <p>Or to put the question in other words:
  Assume the result of the <code>Future</code> is available. Would an implementation of <code>Future</code> be non compliant, if <code>get(long, TimeUnit)</code> called with a negative timeout would do something else than returning this result?</p>