Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Remove(Func<U,bool> shouldRemove)
- {
- Node<U> previous = null;
- int counter = 0;
- for (current = head; current != null; current = current.Next)
- {
- if (shouldRemove(current.Value))
- {
- if (previous != null)
- {
- previous.Next = current.Next;
- }
- else
- {
- head = head.Next;
- }
- }
- else
- {
- previous = current;
- }
- counter++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement