Class ListLinked<T>
Implements a growing, singularly-linked list data structure that inherits InterfaceTraversable.
Inheritance
Implements
Namespace: Towel.DataStructures
Assembly: Towel.dll
Syntax
public class ListLinked<T> : object, IList<T>, IDataStructure<T>, ISteppable<T>, System.Collections.Generic.IEnumerable<T>, DataStructure.IAddable<T>, DataStructure.ICountable, DataStructure.IClearable, ICloneable<ListLinked<T>>
Type Parameters
Name | Description |
---|---|
T | The type of objects to be placed in the list. |
Constructors
| Improve this Doc View SourceListLinked()
Creates an instance of a ListLinked<T>.
Declaration
public ListLinked()
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 |
Methods
| Improve this Doc View SourceClear()
Returns the data structure to an empty state.
Declaration
public void Clear()
Clone()
Clones a T
.
Declaration
public ListLinked<T> Clone()
Returns
Type | Description |
---|---|
ListLinked<T> | A clone of the |
GetEnumerator()
Declaration
public System.Collections.Generic.IEnumerator<T> GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerator<T> |
RemoveAll<TPredicate>(TPredicate)
Removes all predicated items from the list.
Declaration
public void RemoveAll<TPredicate>(TPredicate predicate = default(TPredicate))
where TPredicate : struct, IFunc<T, bool>
Parameters
Type | Name | Description |
---|---|---|
TPredicate | predicate | The predicate to determine removal. |
Type Parameters
Name | Description |
---|---|
TPredicate | The type of predicate to determine removal. |
RemoveFirst(Func<T, Boolean>)
Removes the first equality by object reference.
Declaration
public void RemoveFirst(Func<T, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
Func<T, System.Boolean> | predicate | The predicate to determine removal. |
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. |
TryAdd(T)
Tries to add a value to a data structure.
Declaration
public (bool Success, Exception? Exception) TryAdd(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | The value to add to the data structure. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.Boolean, System.Nullable<Exception>> | True if the value was added or false if not. |
TryRemoveFirst(Func<T, Boolean>)
Tries to remove the first predicated value if the value exists.
Declaration
public bool TryRemoveFirst(Func<T, bool> predicate)
Parameters
Type | Name | Description |
---|---|---|
Func<T, System.Boolean> | predicate | The predicate to determine removal. |
Returns
Type | Description |
---|---|
System.Boolean | True if the value was removed. False if the value did not exist. |
TryRemoveFirst(Func<T, Boolean>, out Nullable<Exception>)
Tries to remove the first predicated value if the value exists.
Declaration
public bool TryRemoveFirst(Func<T, bool> predicate, out Exception? exception)
Parameters
Type | Name | Description |
---|---|---|
Func<T, System.Boolean> | predicate | The predicate to determine removal. |
System.Nullable<Exception> | exception | The exception that occurred if the remove failed. |
Returns
Type | Description |
---|---|
System.Boolean | True if the value was removed. False if the value did not exist. |
TryRemoveFirst<TPredicate>(out Nullable<Exception>, TPredicate)
Tries to remove the first predicated value if the value exists.
Declaration
public bool TryRemoveFirst<TPredicate>(out Exception? exception, TPredicate predicate = default(TPredicate))
where TPredicate : struct, IFunc<T, bool>
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<Exception> | exception | The exception that occurred if the remove failed. |
TPredicate | predicate | The predicate to determine removal. |
Returns
Type | Description |
---|---|
System.Boolean | True if the value was removed. False if the value did not exist. |
Type Parameters
Name | Description |
---|---|
TPredicate | The type of predicate to determine removal. |