1
2
3
4 package com.ochafik.util;
5
6 import java.util.Iterator;
7
8 public interface IntArray extends Iterable<Integer> {
9 public int[] getBackingArray();
10 public int size();
11 public int get(int pos);
12 public int[] toArray();
13
14 public class IntIterator implements Iterator<Integer> {
15 int i = -1;
16 IntArray array;
17
18 public boolean hasNext() {
19 return i < array.size() - 1;
20 }
21
22 public Integer next() {
23 return array.get(++i);
24 }
25
26 public void remove() {
27 throw new UnsupportedOperationException();
28 }
29
30 }
31 }