Skip to content

Commit 4200def

Browse files
committed
refactor: rename SwiftBucket.Remove to TryRemove
1 parent e6d9af0 commit 4200def

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/SwiftCollections/Collections/SwiftBucket.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,16 @@ public void InsertAt(int index, T item)
179179
/// <param name="item">The object to remove.</param>
180180
/// <returns><c>true</c> if item was successfully removed; otherwise, <c>false</c>.</returns>
181181
[MethodImpl(MethodImplOptions.AggressiveInlining)]
182-
public bool Remove(T item)
182+
public bool TryRemove(T item)
183183
{
184184
int index = IndexOf(item);
185185
if (index < 0) return false;
186186
RemoveAt(index);
187187
return true;
188188
}
189189

190+
bool ICollection<T>.Remove(T item) => TryRemove(item);
191+
190192
/// <summary>
191193
/// Removes the item at the specified arrayIndex if it has been allocated.
192194
/// </summary>

tests/SwiftCollections.Tests/Collections/SwiftBucket.Tests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void Remove_ShouldRemoveItemByValue()
6161
bucket.Add("Item2");
6262

6363
// Act
64-
bool removed = bucket.Remove("Item1");
64+
bool removed = bucket.TryRemove("Item1");
6565

6666
// Assert
6767
removed.Should().BeTrue();
@@ -116,7 +116,7 @@ public void Remove_NonExistentItem_ShouldReturnFalse()
116116
bucket.Add(2);
117117

118118
// Act
119-
bool removed = bucket.Remove(3);
119+
bool removed = bucket.TryRemove(3);
120120

121121
// Assert
122122
removed.Should().BeFalse();

tests/SwiftCollections.Tests/Query/SwiftBVH.FixedMathSharp.Tests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ public void StressTest_ResizingIntegrity()
305305
Assert.Equal(numVolumes, results.Count);
306306
}
307307

308-
309308
[Fact]
310309
public void MultiThreaded_ConcurrentOperations()
311310
{

0 commit comments

Comments
 (0)