Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6284402

Clarify which DelayQueue methods can "see" unexpired elements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 6
    • core-libs

      Doug Lea writes,

      "DelayQueue.peek's javadoc/spec was wrong. It said that it would return
      null if there are no unexpired elements (like poll). But unlike poll,
      it does, and was intended to allow you to look at unexpired first
      element.

      Maurice Naftalin, who is writing generics book with Phil Wadler
      pointed this out to me.

      The underlying reason is that we had argued
      about which way this should go, and ended up with the spec
      saying one thing and the code doing the other. Moral: Never argue

      (And worse, the tck test was broken, so allowed either. Also fixed.)


           /**
            * Retrieves, but does not remove, the head of this queue,
            * or returns <tt>null</tt> if this queue is empty.
            * Unlike <tt>poll</tt>, this method can be used to inspect
            * elements that have not yet expired.
            *
            * @return the head of this queue, or <tt>null</tt> if this
            * queue is empty.
            */
      "
      ###@###.### 2005-06-11 21:32:26 GMT

            martin Martin Buchholz
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: