Create new Synchronous Queue - Java java.util

Java examples for java.util:Collection Creation

Description

Create new Synchronous Queue

Demo Code


//package com.java2s;

import java.util.concurrent.SynchronousQueue;

public class Main {
    public static void main(String[] argv) {
        System.out.println(newSynchronousQueue());
    }//from   w w  w .j  ava 2s .co m

    public static <E> SynchronousQueue<E> newSynchronousQueue() {
        return new SynchronousQueue<E>();
    }

    public static <E> SynchronousQueue<E> newSynchronousQueue(
            final boolean fair) {
        return new SynchronousQueue<E>(fair);
    }
}

Related Tutorials