A Deque Class in C#


The Deque class uses a doubly-linked list to implement its collection of elements.  The doubly-linked lists should have two nodes i.e. front and back nodes. This helps in adding elements on the front and back of the Deque.

With the Deque class, you have the ability to add and remove elements from both the sides. This is why Deque is said to be a double-ended queue.

The Deque class has the following methods in the Queue class −

Clear

Clears the collection of all of its elements

Contains

Whether or not an object is in the collection

ToArray

Use the ToArray() method to copy all of the elements in the collection to an array.

Synchronized 

A synchronized wrapper for the collection

Updated on: 19-Jun-2020

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements