public override object Clone() { lock (root) { return(deque.Clone()); } }
private static void TestClone(Deque <int> deque) { deque.Clear(); PopulateDequePushBack(deque); Deque <int> deque2 = (Deque <int>)deque.Clone(); Debug.Assert(deque.Count == deque2.Count); IEnumerator <int> d2 = deque2.GetEnumerator(); d2.MoveNext(); foreach (int item in deque) { Debug.Assert(item.Equals(d2.Current)); d2.MoveNext(); } }
private static void TestClone(Deque deque) { deque.Clear(); PopulateDequePushBack(deque); Deque deque2 = (Deque)deque.Clone(); Debug.Assert(deque.Count == deque2.Count); IEnumerator d2 = deque2.GetEnumerator(); d2.MoveNext(); foreach (object obj in deque) { Debug.Assert(obj.Equals(d2.Current)); d2.MoveNext(); } }