Java LinkedBlockingQueue createLinkedBlockingQueue(Collection collection)

Here you can find the source of createLinkedBlockingQueue(Collection collection)

Description

create Linked Blocking Queue

License

Open Source License

Declaration

public static <E> BlockingQueue<E> createLinkedBlockingQueue(Collection<? extends E> collection) 

Method Source Code

//package com.java2s;

import java.util.Collection;

import java.util.concurrent.BlockingQueue;

import java.util.concurrent.LinkedBlockingQueue;

public class Main {
    public static <E> BlockingQueue<E> createLinkedBlockingQueue() {
        return new LinkedBlockingQueue<E>();
    }/*  w w w  .ja  va 2  s .co m*/

    public static <E> BlockingQueue<E> createLinkedBlockingQueue(int capacity) {
        return new LinkedBlockingQueue<E>(capacity);
    }

    public static <E> BlockingQueue<E> createLinkedBlockingQueue(Collection<? extends E> collection) {
        if (collection == null) {
            return new LinkedBlockingQueue<E>();
        }

        return new LinkedBlockingQueue<E>(collection);
    }
}

Related

  1. getCollection(Class collectionType)
  2. getCollection(Class propertyType)
  3. newLinkedBlockingQeque(int capacity)
  4. newLinkedBlockingQueue(final Collection c)