rotate array with iterator