Jens-Konrad Preem
Jens-Konrad Preem

Reputation: 187

Is there a capacity-restricted queue object in Java that is accessible from both ends?

I was thinking something the likes of java.util.ArrayBlockingQueue, which enables you to create size-limited queues. But that would have methods to retrieve and and add elements from both sides (head or tail). Kind of like Perl arrays which have push/pop and shift/unshift methods.

I can probably roll my own but if something already exists out there I'd like to know.

Upvotes: 0

Views: 482

Answers (1)

Kayaman
Kayaman

Reputation: 73558

There certainly is, the LinkedBlockingDeque.

Upvotes: 2

Related Questions