List of usage examples for java.util.concurrent ArrayBlockingQueue ArrayBlockingQueue
public ArrayBlockingQueue(int capacity, boolean fair, Collection<? extends E> c)
From source file:Main.java
public static void main(String[] argv) throws Exception { List<Integer> list = Arrays.asList(new Integer[] { 0, 1, 2, 3 }); int capacity = 100; ArrayBlockingQueue<Integer> queue = new ArrayBlockingQueue<Integer>(capacity, true, list); queue.put(0);/* www. j a v a 2s. c o m*/ queue.put(1); queue.put(2); System.out.println(queue); System.out.println(list); }
From source file:Main.java
public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(final int capacity, final boolean fair, final Collection<? extends E> c) { return new ArrayBlockingQueue<E>(capacity, fair, c); }
From source file:org.jiemamy.utils.collection.CollectionsUtil.java
/** * {@link ArrayBlockingQueue}?????// w w w . j a v a 2s. c om * * @param <E> {@link ArrayBlockingQueue}?? * @param capacity ?? * @param fair {@code true}??????????? * @param c ????? * @return {@link ArrayBlockingQueue}??? * @throws IllegalArgumentException {@code c}?{@code null}??? * @throws IllegalArgumentException if {@code capacity} is less than {@code c.size()}, or less than 1. * @see ArrayBlockingQueue#ArrayBlockingQueue(int, boolean, Collection) */ public static <E> ArrayBlockingQueue<E> newArrayBlockingQueue(int capacity, boolean fair, Collection<? extends E> c) { Validate.notNull(c); return new ArrayBlockingQueue<E>(capacity, fair, c); }