About 66,300 results
Open links in new tab
  1. Best implementation of Java Queue? - Stack Overflow

    Jun 25, 2019 · You can use .offer(E e) to append an element to the end of the queue and .poll() to dequeue and retrieve the head (first element) of the queue. Java defined the interface Queue, …

  2. How do I instantiate a Queue object in java? - Stack Overflow

    A Queue is an interface, which means you cannot construct a Queue directly.. The best option is to construct off a class that already implements the Queue interface, like one of the following: …

  3. Where is the Queue class in the Java Collections?

    Apr 29, 2009 · No, there is no Queue class, because there are lots of different ways to implement a queue and you have to pick the one that suits your use case. The same goes for any of the …

  4. Java: LinkedList class as stack and queues - Stack Overflow

    Jul 26, 2016 · Queue. A LinkedList is already a queue, since it implements the Queue interface (and check the Javadoc yourself). Hence it has the following queue operations: enqueue: …

  5. FIFO class in Java - Stack Overflow

    Mar 6, 2012 · This has the advantage of allowing you to replace the underlying concrete class with any class that provides the Queue interface, without having to change the code too much. …

  6. Java Collections (LIFO Structure) - Stack Overflow

    Basically I want a really simple stack; my perfect option would be a Deque, but I am in Java 1.5. I would like not to have to add another class to my structure but I am wondering if that is …

  7. queue - Enqueue, Dequeue and ViewQueue in Java - Stack Overflow

    Jul 9, 2013 · Take a look to the first object in the queue: element(): throws exception if the queue is empty; peek(): returns null if the queue is empty; The add method, which Queue inherits …

  8. Java: How to create a queue based on a Node class

    May 26, 2014 · I'm trying to create a queue using two classes, a Node class and a Queue class for an assignment. Here's the node class: class Node { protected Node next; public Node() { …

  9. A simple scenario using wait () and notify () in java

    Mar 29, 2010 · As some of the other answers have mentioned, Java 1.5 introduced a new concurrency library (in the java.util.concurrent package) which was designed to provide a …

  10. java - How do I use a PriorityQueue? - Stack Overflow

    Java 8 solution. We can use lambda expression or method reference introduced in Java 8. In case we have some String values stored in the Priority Queue (having capacity 5) we can …

Refresh