implemented an iterator which reverses the element of an array