Create new Linked Blocking Queue - Java java.util

Java examples for java.util:Collection Creation

Description

Create new Linked Blocking Queue

Demo Code


//package com.java2s;

import java.util.Collection;

import java.util.concurrent.LinkedBlockingQueue;

public class Main {
    public static void main(String[] argv) {
        System.out.println(newLinkedBlockingQueue());
    }/* w  w w.jav a 2 s  .  co m*/

    public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue() {
        return new LinkedBlockingQueue<E>();
    }

    public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(
            final Collection<? extends E> c) {
        return new LinkedBlockingQueue<E>(c);
    }

    public static <E> LinkedBlockingQueue<E> newLinkedBlockingQueue(
            final int initialCapacity) {
        return new LinkedBlockingQueue<E>(initialCapacity);
    }
}

Related Tutorials