View RSS Feed

Recent Blogs Posts

  1. Adding and Accessing Queue Elements

    by , 02-19-2012 at 07:05 AM
    Call add() method for addition of the elements to Queue. This is an inherited type of method of Collection interface.

    Different elements are added to a Queue which is explained by this given code.

    Java Code: This is the code to explain add operation in Java Queue
    Queue myQueue = new LinkedList();
    myQueue.add("element 1");
    myQueue.add("element 2");
    myQueue.add("element 3");
    In a Queue, added elements get stored in internal order and they are dependent upon implementation. ...
  2. Java Queue Implementations

    by , 02-19-2012 at 07:02 AM
    Collection Interface’s subtype is Queue. In the Queue interface, collection interface methods are present automatically.

    Queue interface instance can’t be created. Queue interface concrete implementations are required. In Collections API, the available Queue implementations are as following. Among them, one can make a choice:
    • java.util.PriorityQueue
    • java.util.LinkedList


    LinkedList is a considered to be a standard queue implementation.

    ...
    Categories
    Queue
  3. Java – Queue Example

    by , 02-19-2012 at 07:00 AM
    Queue base is at first in first out policy. The Queue interface is present in java.util package. Queue size is not required to be specified just like it is done in arrays.

    Functionality of Queue is explained in the given code.

    Example of Queue
    Java Code: This is the code to explain Java Queue
    import java.util.Iterator;
    import java.util.LinkedList;
    import java.util.Queue;
    
    public class QueueTesting {
    
        public static void main(String[] args) {
    ...
    Tags: java queue Add / Edit Tags
    Categories
    Queue
  4. Java Queue

    by , 02-19-2012 at 06:58 AM
    Java Queue is also collection interface for holding the objects. Collections store or hold elements, before processing. Following operations are provided by Queues:

    1. Insertion
    2. Inspections
    3. Extraction
    4. (All) Other Collection operations

    Queues are basically first in first order implements. They don’t depend on use order. Poll() and remove() methods are used to remove the elements present at head.

    From queue’s tail, all elements ...
    Tags: java queue Add / Edit Tags
    Categories
    Queue