1 21 package com.db4o.foundation; 22 23 24 27 public class IntIterator4Impl implements IntIterator4 { 28 29 private final int _count; 30 private int[] _content; 31 private int _current; 32 33 public IntIterator4Impl(int[] content, int count) { 34 _content = content; 35 _count = count; 36 reset(); 37 } 38 39 public int currentInt() { 40 if (_content == null || _current == _count) { 41 throw new IllegalStateException (); 42 } 43 return _content[_current]; 44 } 45 46 public Object current() { 47 return new Integer (currentInt()); 48 } 49 50 public boolean moveNext() { 51 if (_current < _count - 1) { 52 _current ++; 53 return true; 54 } 55 _content = null; 56 return false; 57 } 58 59 public void reset() { 60 _current = -1; 61 } 62 63 } 64 | Popular Tags |