<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    Hi,<br>
    <br>
    The upstream source of PriorityBlockingQueue is the concurrency
    library maintained by Doug Lea.<br>
    Noting this suggestion to the Concurrency Interest mailing list is
    recommended. [1]<br>
    <br>
    Regards, Roger<br>
    <br>
    [1] <a href="http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest" class="moz-txt-link-freetext">
      http://altair.cs.oswego.edu/mailman/listinfo/concurrency-interest</a><br>
    <br>
    <div class="moz-cite-prefix">On 5/24/23 2:51 PM, Viktor Klang wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:MW4PR10MB5774B0853A5BF7A5D9C6EFF9FF419@MW4PR10MB5774.namprd10.prod.outlook.com">
      
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
        Sounds very reasonable.<br>
      </div>
      <hr style="display:inline-block;width:98%" tabindex="-1">
      <div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b>
          core-libs-dev <a class="moz-txt-link-rfc2396E" href="mailto:core-libs-dev-retn@openjdk.org"><core-libs-dev-retn@openjdk.org></a> on behalf
          of Aleksei Ivanov <a class="moz-txt-link-rfc2396E" href="mailto:alexey.ivanov@oracle.com"><alexey.ivanov@oracle.com></a><br>
          <b>Sent:</b> Wednesday, 24 May 2023 20:03<br>
          <b>To:</b> Robin Gong <a class="moz-txt-link-rfc2396E" href="mailto:irobingong@gmail.com"><irobingong@gmail.com></a>; core-libs
          <a class="moz-txt-link-rfc2396E" href="mailto:core-libs-dev@openjdk.org"><core-libs-dev@openjdk.org></a><br>
          <b>Subject:</b> Re: Remove unnecessary method call in
          PriorityBlockingQueue</font>
        <div> </div>
      </div>
      <div>Hi Robin,<br>
        <br>
        This belongs in core-libs.<br>
        <br>
        <div class="x_moz-cite-prefix">On 24/05/2023 16:50, Robin Gong
          wrote:<br>
        </div>
        <blockquote type="cite">
          <div dir="ltr">Hi,
            <div><br>
            </div>
            <div>Recently, I found this constructor
              in PriorityBlockingQueue:</div>
            <div><br>
            </div>
            <blockquote class="x_gmail_quote" style="margin:0px 0px 0px
              0.8ex; border-left:1px solid rgb(204,204,204);
              padding-left:1ex">
                  public PriorityBlockingQueue(int initialCapacity,<br>
                                               Comparator<? super
              E> comparator) {<br>
                      if (initialCapacity < 1)<br>
                          throw new IllegalArgumentException();<br>
                      this.comparator = comparator;<br>
                      this.queue = new Object[Math.max(1,
              initialCapacity)];<br>
                  }</blockquote>
            <div><br>
            </div>
            <div>I believe we could change 'Math.max(1,
              initialCapacity)' to 'initialCapacity'.
              Since initialCapacity must be greater or equal to 1.</div>
          </div>
        </blockquote>
        <br>
        It looks reasonable to me.<br>
        <br>
        -- <br>
        Regards,<br>
        Alexey<br>
        <br>
        <blockquote type="cite">
          <div dir="ltr">
            <div><br>
            </div>
            <div>And also that's how PriorityQueue running.</div>
            <div><br>
            </div>
            <blockquote class="x_gmail_quote" style="margin:0px 0px 0px
              0.8ex; border-left:1px solid rgb(204,204,204);
              padding-left:1ex">
                  public PriorityQueue(int initialCapacity,<br>
                                       Comparator<? super E>
              comparator) {<br>
                      // Note: This restriction of at least one is not
              actually needed,<br>
                      // but continues for 1.5 compatibility<br>
                      if (initialCapacity < 1)<br>
                          throw new IllegalArgumentException();<br>
                      this.queue = new Object[initialCapacity];<br>
                      this.comparator = comparator;<br>
                  }</blockquote>
            <div><br>
            </div>
            <div>Best regarts,</div>
            <div>Robin Gong</div>
          </div>
        </blockquote>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>