Similarly, when a thread tries to put elements into a full queue, it waits until some other thread takes the elements out of the queue to get free space for the elements. When a thread tries to get items from an empty queue, it waits until some other thread puts the items into the queue. thread is trying to put elements in the full queue. thread is trying to get elements from an empty queue. Let's take a glimpse at these groups.ĭequesDeque means Double- Ended Queue and supports addition or removal from either tail of the data as a queue (first-in-first-out/FIFO) or from the head as another popular data structure called stack (last-in-first-out/LIFO).Ĭlasses that implement Deque Interface: ArrayDeque, ConcurrentLinkedDeque, LinkedBlockingDeque, LinkedList.īlocking QueuesA blocking queue is a queue that blocks a thread in two cases: You may divide them into 3 groups: Deques, Blocking Queues and Transfer Queues with BlockingDeque belonging to the two first. Subinterfaces of Java Queue Queue interface is inherited by 4 subinterfaces – BlockingDeque, BlockingQueue, Deque, TransferQueue.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |