public void IndexOf_Null() { for (int i = 0; i < ImplicitInt; i++) { deq.Add(5); } deq.Insert(8, null); Assert.AreEqual(8, deq.IndexOf(null)); }
public static int IndexOf(object obj, object entry) { if (obj is IList) { IList a = (IList)obj; return(a.IndexOf(entry)); } else { IDeque a = (IDeque)obj; return(a.IndexOf(entry)); } }
public static int IndexOf(object obj, object entry, int startIndex) { if (obj is IList) { IList a = (IList)obj; for (int i = startIndex; i < a.Count; ++i) { if (a[i].Equals(entry)) { return(i); } } } else { IDeque a = (IDeque)obj; return(a.IndexOf(entry, startIndex)); } return(-1); }
public void IndexOf() { AddToBoth(); Assert.AreEqual(fake.IndexOf(0), deq.IndexOf(0)); Assert.AreEqual(fake.IndexOf(implicitLength - 3), deq.IndexOf(implicitLength - 3)); }