private static void RemoveItem(IRemoveable collection, int count, List <string> removedElementsList) { for (int i = 0; i < count; i++) { removedElementsList.Add(collection.Remove()); } }
public void BackwardInputIteratorTest2() { int[] data = { 1, 2, 2, 3 }; int[] output = new int[2]; int removeValue = 2; using (IIntRandomAccessIterator <int> inputIterator = new BackwardInputIterator <int>(data)) { int index = 0; IRemoveable removeable = inputIterator as IRemoveable; while (!inputIterator.IsEnd()) { //testing if the remove work if (inputIterator.Read().Equals(removeValue)) { removeable.Remove(); } else { output[index] = inputIterator.Read(); ++index; } inputIterator.MoveNext(); } Assert.IsTrue(output[0] == 3 && output[1] == 1); } }
static void RemoveFromCollections(IRemoveable collection, int removeCount) { for (int i = 0; i < removeCount; i++) { Console.Write(collection.Remove() + " "); } Console.WriteLine(); }
public static void PrintRemove(int removeOperations, IRemoveable collection) { for (int i = 0; i < removeOperations; i++) { Console.Write(collection.Remove() + " "); } Console.WriteLine(); }