Class QueueLinked<T>
Implements First-In-First-Out queue data structure using a linked list.
Inheritance
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public class QueueLinked<T> : object, IQueue<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.ICountable, DataStructure.IClearable, ICloneable<QueueLinked<T>>
Type Parameters
Name | Description |
---|---|
T | The generic type within the structure. |
Constructors
| Improve this Doc View SourceQueueLinked()
Creates an instance of a queue.
Runtime: O(1)
Declaration
public QueueLinked()
Properties
| Improve this Doc View SourceCount
Gets the current count of the data structure.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Newest
The current newest element in the queue.
Declaration
public T Newest { get; }
Property Value
Type | Description |
---|---|
T |
Oldest
The current oldest element in the queue.
Declaration
public T Oldest { get; }
Property Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceClear()
Returns the data structure to an empty state.
Declaration
public void Clear()
Clone()
Clones a T
.
Declaration
public QueueLinked<T> Clone()
Returns
Type | Description |
---|---|
QueueLinked<T> | A clone of the |
Dequeue()
Removes the oldest item in the queue.
Declaration
public T Dequeue()
Returns
Type | Description |
---|---|
T | The next item in the queue. |
Enqueue(T)
Adds an item to the back of the queue.
Declaration
public void Enqueue(T enqueue)
Parameters
Type | Name | Description |
---|---|---|
T | enqueue | The item to add to the queue. |
GetEnumerator()
Declaration
public System.Collections.Generic.IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T> |
Peek()
Gets the next item in the queue without removing it.
Declaration
public T Peek()
Returns
Type | Description |
---|---|
T | The next item in the queue. |
StepperBreak<TStep>(TStep)
Traverses values and invokes a function on every T
value.
Declaration
public StepStatus StepperBreak<TStep>(TStep step = default(TStep))
where TStep : struct, IFunc<T, StepStatus>
Parameters
Type | Name | Description |
---|---|---|
TStep | step | The function to invoke on every |
Returns
Type | Description |
---|---|
StepStatus | The status of the traversal. |
Type Parameters
Name | Description |
---|---|
TStep | The type of function to invoke on every |
ToArray()
Constructs an array with the values of this data structure.
Declaration
public T[] ToArray()
Returns
Type | Description |
---|---|
T[] | An array with the values of this data structure. |