LinkedBlockingQueue

1. Add operations

Enqueue Offer: returns false directly but does not block offer(E E, long timeout, TimeUnit Unit) : returns false after the specified timeout periodCopy the code

2. Out of line operation

Poll: returns null poll(long timeout, TimeUnit Unit): returns null remove(): throws an exception if the value is nullCopy the code

3. Get elements

Peek: returns directly, null if null element(): throws an exception if nullCopy the code

ArrayBlockingQueue

1. Add operations

Enqueue Offer: returns false directly but does not block offer(E E, long timeout, TimeUnit Unit) : returns false after the specified timeout periodCopy the code

2. Out of line operation

Poll: returns null poll(long timeout, TimeUnit Unit): returns null remove(): throws an exception if the value is nullCopy the code

3. Get elements

Peek: returns directly, null if null element(): throws an exception if nullCopy the code