1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Merge pull request #1459 from disarray2077/patch-2

Add `GetAndRemoveStrict` to `List<T>`
This commit is contained in:
Brian Fiete 2022-02-18 09:10:09 -08:00 committed by GitHub
commit b886f3d3c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -812,6 +812,19 @@ namespace System.Collections
return .Err;
}
public Result<T> GetAndRemoveStrict(T item)
{
int index = IndexOfStrict(item);
if (index >= 0)
{
T val = mItems[index];
RemoveAt(index);
return val;
}
return .Err;
}
public Result<T> GetAndRemoveAlt<TAlt>(TAlt item) where TAlt : IHashable where bool : operator T == TAlt
{
int index = IndexOfAlt(item);