ArrayIterator.hx 321 B

123456789101112131415161718
  1. package hxd.impl;
  2. @:generic class ArrayIterator<T> {
  3. var i : Int;
  4. var l : Int;
  5. var a : Array<T>;
  6. public inline function new(a) {
  7. this.i = 0;
  8. this.a = a;
  9. this.l = this.a.length;
  10. }
  11. public inline function hasNext() {
  12. return i < l;
  13. }
  14. public inline function next() : T {
  15. return a[i++];
  16. }
  17. }