in Java, there's a class called Deque, and i would like to find something similar to this in .NET (C#).
The reason i need this, is because i need to peek the last item in the collection, and then dequeue the first one in the collection.
Thanks, AJ Ravindiran.
Check out .NET's System.Collections.Generic.LinkedList collection, which can be used as a Deque. It's a doubly linked list.
Insertion/Deletion
AddFirst: Add to beginningAddLast: Add to endRemoveFirst: Remove from beginning. Does not return value.RemoveLast: Remove from end. Does not return value.Peeking:
First/Last Properties.
These Return a LinkedListNode<T>, not the actual value. To get the value you have to add .Value to the end.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With