FWList is the mutable variant of the FVList data structure.
An article is available online about the VList data types.
See the remarks of VListBlock{T} for more information about VLists and WLists. It is most efficient to add items to the front of a FWList (at index 0) or the back of an WList (at index Count-1).
|
| FWList (int initialSize) |
|
| FWList (T itemZero, T itemOne) |
|
| FWList (IList< T > list) |
|
void | AddRange (IList< T > list) |
|
void | InsertRange (int index, IList< T > list) |
|
void | RemoveRange (int index, int count) |
|
new void | Insert (int index, T item) |
|
new void | RemoveAt (int index) |
|
new FVList< T >.Enumerator | GetEnumerator () |
|
VList< T >.Enumerator | ReverseEnumerator () |
|
new T | TryGet (int index, out bool fail) |
| Gets the item at the specified index, and does not throw an exception on failure. More...
|
|
FWList< T > | Clone () |
|
FWList< T > | Where (Predicate< T > keep) |
| Applies a filter to a list, to exclude zero or more items. More...
|
|
FWList< T > | WhereSelect (Func< T, Maybe< T >> filter) |
| Filters and maps a list with a user-defined function. More...
|
|
FWList< T > | SmartSelect (Func< T, T > map) |
| Maps a list to another list of the same length. More...
|
|
FWList< Out > | Select< Out > (Func< T, Out > map) |
| Maps a list to another list of the same length. More...
|
|
FWList< T > | Transform (VListTransformer< T > x) |
| Transforms a list (combines filtering with selection and more). More...
|
|
T | Pop () |
| Removes the front item (at index 0) from the list and returns it. More...
|
|
FVList< T > | WithoutFirst (int numToRemove) |
|
WList< T > | ToWList () |
| Returns this list as an WList, which effectively reverses the order of the elements. More...
|
|
T[] | ToArray () |
| Returns the FWList converted to an array. More...
|
|
new void | Add (T item) |
|
new void | Clear () |
|
new void | Insert (int index, T item) |
|
new void | RemoveAt (int index) |
|
new int | IndexOf (T item) |
|
new bool | Contains (T item) |
|
new void | CopyTo (T[] array, int arrayIndex) |
|
new bool | Remove (T item) |
|
IEnumerator< T > | GetEnumerator () |
|
T | TryGet (int index, out bool fail) |
| Gets the item at the specified index, and does not throw an exception on failure. More...
|
|
Slice_< T > | Slice (int start, int count) |
| Returns a sub-range of this list. More...
|
|
void | Push (T item) |
| Synonym for Add(); adds an item to the front of the list. More...
|
|
new FVList< T > | ToFVList () |
|
new VList< T > | ToVList () |
|
|
override int | AdjustWListIndex (int index, int size) |
| This method implements the difference between FWList and WList: In FWList it returns index , but in WList it returns Count-size-index . More...
|
|
override IEnumerator< T > | GetIEnumerator () |
|
| WListProtected (WListProtected< T > original, bool takeOwnership) |
|
T | GetAt (int index) |
| Gets an item from a FWList or WList at the specified index. More...
|
|
void | SetAt (int index, T value) |
| Sets an item in a FWList or WList at the specified index. More...
|
|
void | Add (T item) |
| Inserts an item at the "front" of the list, which is index 0 for FWList, or Count for WList. More...
|
|
void | Insert (int index, T item) |
|
void | RemoveAt (int index) |
|
int | IndexOf (T item) |
| Searches for the specified object and returns the zero-based index of the first occurrence (lowest index) within the entire FVList. More...
|
|
bool | Contains (T item) |
|
void | CopyTo (T[] array, int arrayIndex) |
|
bool | Remove (T item) |
|
FVList< T >.Enumerator | GetVListEnumerator () |
|
VList< T >.Enumerator | GetRVListEnumerator () |
|
void | AddRange (IEnumerator< T > items) |
|
void | RemoveAtDff (int distanceFromFront) |
|
void | RemoveRangeBase (int distanceFromFront, int count) |
|
void | AddRangeBase (IList< T > items, bool isRWList) |
|
void | InsertRangeAtDff (int distanceFromFront, IList< T > items, bool isRWList) |
|
void | InsertAtDff (int distanceFromFront, T item) |
|
T | GetAtDff (int distanceFromFront) |
| Gets an item WITHOUT doing a range check More...
|
|
void | SetAtDff (int distanceFromFront, T item) |
| Sets an item WITHOUT doing a range or mutability check More...
|
|
FVList< T > | ToFVList () |
| Returns this list as a FVList; if this is a WList, the order of the elements is reversed at the same time. More...
|
|
VList< T > | ToVList () |
| Returns this list as a VList; if this is a FWList, the order of the elements is reversed at the same time. More...
|
|
override int Loyc.Collections.FWList< T >.AdjustWListIndex |
( |
int |
index, |
|
|
int |
size |
|
) |
| |
|
inlineprotectedvirtual |
This method implements the difference between FWList and WList: In FWList it returns index
, but in WList it returns Count-size-index
.
- Parameters
-
index | Index to adjust |
size | Number of elements being accessed or removed |
Solely as an optimization, FWList and WList also have separate versions of this[], InsertAt and RemoveAt.
Reimplemented from Loyc.Collections.WListProtected< T >.
new T Loyc.Collections.FWList< T >.TryGet |
( |
int |
index, |
|
|
out bool |
fail |
|
) |
| |
|
inline |
Gets the item at the specified index, and does not throw an exception on failure.
- Parameters
-
index | An index in the range 0 to Count-1. |
fail | A flag that is set on failure. |
- Returns
- The element at the specified index, or default(T) if the index is not valid.
In my original design, the caller could provide a value to return on failure, but this would not allow T to be marked as "out" in C# 4. For the same reason, we cannot have a ref/out T parameter. Instead, the following extension methods are provided:
bool TryGet(
int index, ref T value);
T
TryGet(
int, T defaultValue);
Implements Loyc.Collections.IListSource< out T >.