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());
    }//ww  w  .  j  av a  2 s  . com

    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