001 /** 002 * 003 */ 004 package com.ochafik.util; 005 006 import java.util.Iterator; 007 008 public interface IntArray extends Iterable<Integer> { 009 public int[] getBackingArray(); 010 public int size(); 011 public int get(int pos); 012 public int[] toArray(); 013 014 public class IntIterator implements Iterator<Integer> { 015 int i = -1; 016 IntArray array; 017 018 public boolean hasNext() { 019 return i < array.size() - 1; 020 } 021 022 public Integer next() { 023 return array.get(++i); 024 } 025 026 public void remove() { 027 throw new UnsupportedOperationException(); 028 } 029 030 } 031 }