public long iterate(Iterator<E> iterator) {
        return storage.iterate(iterator);
    }
@Test
    public void testIterate() {
        SparseIntArray.Iterator<Integer> iterator = new SparseIntArray.Iterator<>();

        // test empty array
        verifyIterate(iterator);

        // try dense
        for (int i = 0; i < ARRAY_STORAGE_32_MAX_SPARSE_SIZE / 2; ++i) {
            set(i);
            verifyIterate(iterator);
        }

        // go sparse
        for (int i = 1000000; i < 1000000 + ARRAY_STORAGE_32_MAX_SPARSE_SIZE; ++i) {
            set(i);
            verifyIterate(iterator);
        }

        // clear everything we have added
        for (int i = 0; i < ARRAY_STORAGE_32_MAX_SPARSE_SIZE / 2; ++i) {
            clear(i);
            verifyIterate(iterator);
        }
        for (int i = 1000000; i < 1000000 + ARRAY_STORAGE_32_MAX_SPARSE_SIZE; ++i) {
            clear(i);
            verifyIterate(iterator);
        }

        // test empty again
        verifyIterate(iterator);

        // try gaps
        for (int i = 0; i < 1000; ++i) {
            set(i * i);
            verifyIterate(iterator);
        }

        // try larger gaps
        for (int i = (int) Math.sqrt(Integer.MAX_VALUE) - 1000; i < (int) Math.sqrt(Integer.MAX_VALUE); ++i) {
            set(i * i);
            verifyIterate(iterator);
        }

        // try some edge cases
        for (int i = -2; i <= 2; ++i) {
            set(i);
            verifyIterate(iterator);
        }
        for (int i = Short.MAX_VALUE - 2; i <= Short.MAX_VALUE + 2; ++i) {
            set(i);
            verifyIterate(iterator);
        }
        for (int i = Short.MIN_VALUE - 2; i <= Short.MIN_VALUE + 2; ++i) {
            set(i);
            verifyIterate(iterator);
        }
        for (long i = (long) Integer.MAX_VALUE - 2; i <= (long) Integer.MAX_VALUE + 2; ++i) {
            set((int) i);
            verifyIterate(iterator);
        }
        for (long i = (long) Integer.MIN_VALUE - 2; i <= (long) Integer.MIN_VALUE + 2; ++i) {
            set((int) i);
            verifyIterate(iterator);
        }
    }