package com.logicbig.example.arrayblockingqueue;
import java.util.Arrays;
import java.util.concurrent.ArrayBlockingQueue;
public class AddAllExample2 {
public static void main(String... args) {
ArrayBlockingQueue<Integer> q = new ArrayBlockingQueue<>(2);
q.addAll(Arrays.asList(1, 2, 3));
System.out.println(q);
}
}
Output
Caused by: java.lang.IllegalStateException: Queue full
at java.base/java.util.AbstractQueue.add(AbstractQueue.java:98)
at java.base/java.util.concurrent.ArrayBlockingQueue.add(ArrayBlockingQueue.java:326)
at java.base/java.util.AbstractQueue.addAll(AbstractQueue.java:187)
at com.logicbig.example.arrayblockingqueue.AddAllExample2.main(AddAllExample2.java:15)
... 6 more