@Override
    public Iterator<E> iterator() {
        return new Iterator<E>() {
            private int current = realCount - 1;

            @Override
            public boolean hasNext() {
                return current >= 0;
            }

            @Override
            @SuppressWarnings("unchecked")
            public E next() {
                if (hasNext())
                    return (E) array[current--];
                else
                    return null;
            }

            @Override
            public void remove() {
                if (hasNext()) {
                    array[current--] = null;
                    realCount--;
                }
            }
        };
    }