public bool Remove(T item) { ArrayLinkedListNode <T>?node = Find(item); if (!node.HasValue) { return(false); } ushort removed = node.Value.Index; if (_previous[removed] == Nil) { RemoveFirst(); } else if (_next[removed] == Nil) { RemoveLast(); } else { RemoveInternalNode(removed); } return(true); }
public void Find(string testName, string[] items, string findValue, bool expectedFound) { // act ArrayLinkedList <string> target = new(); foreach (string item in items) { target.AddLast(item); } ArrayLinkedListNode <string>?node = target.Find(findValue); // assert if (expectedFound) { using AssertionScope _ = new(); node.Should().NotBeNull(); if (node.HasValue) { node.Value.Value.Should().Be(findValue); } } else { node.Should().BeNull(); } }
public bool Contains(T item) { ArrayLinkedListNode <T>?node = Find(item); return(node.HasValue); }