10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.util;
27
28 import java.util.function.Consumer;
29 import java.util.function.Predicate;
30 import jdk.internal.misc.SharedSecrets;
31
32 /**
33 * An unbounded priority {@linkplain Queue queue} based on a priority heap.
34 * The elements of the priority queue are ordered according to their
35 * {@linkplain Comparable natural ordering}, or by a {@link Comparator}
36 * provided at queue construction time, depending on which constructor is
37 * used. A priority queue does not permit {@code null} elements.
38 * A priority queue relying on natural ordering also does not permit
39 * insertion of non-comparable objects (doing so may result in
40 * {@code ClassCastException}).
41 *
42 * <p>The <em>head</em> of this queue is the <em>least</em> element
43 * with respect to the specified ordering. If multiple elements are
44 * tied for least value, the head is one of those elements -- ties are
45 * broken arbitrarily. The queue retrieval operations {@code poll},
46 * {@code remove}, {@code peek}, and {@code element} access the
47 * element at the head of the queue.
48 *
49 * <p>A priority queue is unbounded, but has an internal
50 * <i>capacity</i> governing the size of an array used to store the
|
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package java.util;
27
28 import java.util.function.Consumer;
29 import java.util.function.Predicate;
30 import jdk.internal.access.SharedSecrets;
31
32 /**
33 * An unbounded priority {@linkplain Queue queue} based on a priority heap.
34 * The elements of the priority queue are ordered according to their
35 * {@linkplain Comparable natural ordering}, or by a {@link Comparator}
36 * provided at queue construction time, depending on which constructor is
37 * used. A priority queue does not permit {@code null} elements.
38 * A priority queue relying on natural ordering also does not permit
39 * insertion of non-comparable objects (doing so may result in
40 * {@code ClassCastException}).
41 *
42 * <p>The <em>head</em> of this queue is the <em>least</em> element
43 * with respect to the specified ordering. If multiple elements are
44 * tied for least value, the head is one of those elements -- ties are
45 * broken arbitrarily. The queue retrieval operations {@code poll},
46 * {@code remove}, {@code peek}, and {@code element} access the
47 * element at the head of the queue.
48 *
49 * <p>A priority queue is unbounded, but has an internal
50 * <i>capacity</i> governing the size of an array used to store the
|