everlobi.blogg.se

Queue java
Queue java





queue java
  1. #QUEUE JAVA SOFTWARE#
  2. #QUEUE JAVA CODE#
queue java

* * Queue} implementations generally do not allow insertion * of null} elements, although some implementations, such as * LinkedList}, do not prohibit insertion of null}. These methods, * which wait for elements to appear or for space to become available, are * defined in the } interface, which * extends this interface. * * The Queue} interface does not define the blocking queue * methods, which are common in concurrent programming. * * The #element()} and #peek()} methods return, but do * not remove, the head of the queue. The remove()} and * poll()} methods differ only in their behavior when the * queue is empty: the remove()} method throws an exception, * while the poll()} method returns null}. * Exactly which element is removed from the queue is a * function of the queue's ordering policy, which differs from * implementation to implementation. * * The #remove()} and #poll()} methods remove and * return the head of the queue. The * offer} method is designed for use when failure is a normal, * rather than exceptional occurrence, for example, in fixed-capacity * (or 'bounded') queues. This differs from the * #add Collection.add} method, which can fail to * add an element only by throwing an unchecked exception. * * The #offer offer} method inserts an element if possible, * otherwise returning false}. Every Queue} implementation * must specify its ordering properties. Other kinds of queues may use * different placement rules. In a FIFO queue, all new elements are inserted at * the tail of the queue. * Whatever the ordering used, the head of the queue is that * element which would be removed by a call to #remove() } or * #poll()}. Among the exceptions are * priority queues, which order elements according to a supplied * comparator, or the elements' natural ordering, and LIFO queues (or * stacks) which order the elements LIFO (last-in-first-out). * * * Summary of Queue methods * * * Throws exception * Returns special value * * * Insert * Queue#add add(e)} * Queue#offer offer(e)} * * * Remove * Queue#remove remove()} * Queue#poll poll()} * * * Examine * Queue#element element()} * Queue#peek peek()} * * * * Queues typically, but do not necessarily, order elements in a * FIFO (first-in-first-out) manner. The latter form of the insert operation is designed * specifically for use with capacity-restricted Queue} * implementations in most implementations, insert operations cannot * fail. Each of these methods exists in two forms: one throws * an exception if the operation fails, the other returns a special * value (either null} or false}, depending on the * operation). * Besides basic Collection} operations, * queues provide additional insertion, extraction, and inspection * operations. * However, the following notice accompanied the original version of this * file: * * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at * */ package java.util /** * A collection designed for holding elements prior to processing.

#QUEUE JAVA SOFTWARE#

*/ /* * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit if you need additional information or have any * questions. * * You should have received a copy of the GNU General Public License version * 2 along with this work if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

queue java

See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code).

#QUEUE JAVA CODE#

* * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code.

queue java

* * This code is free software you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Line source /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.







Queue java