public Cd Next() { Cd cd = CdRack.GetCdAt(Index); this.Index++; return(cd); }
public bool HasNext() { if (Index < CdRack.GetLength()) { return(true); } else { return(false); } }
public void GenericsIteratorTest2() { CdRack cdRack = new CdRack(); cdRack.AppendCd(new Cd("Thriller")); cdRack.AppendCd(new Cd("Back in Black")); cdRack.AppendCd(new Cd("Bat out of Hell")); cdRack.AppendCd(new Cd("The Dark Side of the Moon")); IIterator <Cd> it = cdRack.Iterator(); while (it.HasNext()) { Cd cd = it.Next(); Debug.WriteLine(cd.Title); } }
public CdRackIterator(CdRack cdRack) { this.CdRack = cdRack; this.Index = 0; }