Skip to content

Instantly share code, notes, and snippets.

@ssukhpinder
Created May 30, 2021 13:24
Show Gist options
  • Save ssukhpinder/23a762f13904d99498f739a18365db90 to your computer and use it in GitHub Desktop.
Save ssukhpinder/23a762f13904d99498f739a18365db90 to your computer and use it in GitHub Desktop.
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