Created
May 30, 2021 13:24
-
-
Save ssukhpinder/23a762f13904d99498f739a18365db90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MotercycleIterator : IVehicleIterator | |
{ | |
private string[] _motercylces; | |
private int _current; | |
public MotercycleIterator(string[] motercylces) | |
{ | |
_motercylces = motercylces; | |
_current = 0; | |
} | |
public string Current() | |
{ | |
return _motercylces[_current]; | |
} | |
public void First() | |
{ | |
_current = 0; | |
} | |
public bool IsDone() | |
{ | |
return _current >= _motercylces.Length; | |
} | |
public string Next() | |
{ | |
return _motercylces[_current++]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment