Class ListExtensions
List extensions.
Namespace: Unity.Collections
Syntax
public static class ListExtensions
Methods
RemoveAtSwapBack<T>(List<T>, Int32)
Truncates the list by replacing the item at the specified index with the last item in the list. The list is shortened by one.
Declaration
public static void RemoveAtSwapBack<T>(this List<T> list, int index)
Parameters
Type | Name | Description |
---|---|---|
List<T> | list | List to perform removal. |
Int32 | index | The index of the item to delete. |
Type Parameters
Name | Description |
---|---|
T | Source type of elements |
RemoveSwapBack<T>(List<T>, T)
Truncates the list by replacing the item at the specified index with the last item in the list. The list is shortened by one.
Declaration
public static bool RemoveSwapBack<T>(this List<T> list, T item)
Parameters
Type | Name | Description |
---|---|---|
List<T> | list | List to perform removal. |
T | item | Item value to remove. |
Returns
Type | Description |
---|---|
Boolean | Returns true if item is removed, if item was not in the container returns false. |
Type Parameters
Name | Description |
---|---|
T | Source type of elements |
RemoveSwapBack<T>(List<T>, Predicate<T>)
Truncates the list by replacing the item at the specified index with the last item in the list. The list is shortened by one.
Declaration
public static bool RemoveSwapBack<T>(this List<T> list, Predicate<T> matcher)
Parameters
Type | Name | Description |
---|---|---|
List<T> | list | List to perform removal. |
Predicate<T> | matcher |
Returns
Type | Description |
---|---|
Boolean | Returns true if item is removed, if item was not in the container returns false. |
Type Parameters
Name | Description |
---|---|
T | Source type of elements |