<div dir="ltr">Hi,<div><br></div><div>Recently, I found this constructor in PriorityBlockingQueue:</div><div><br></div><blockquote class="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><br></div><div>And also that's how PriorityQueue running.</div><div><br></div><blockquote class="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>