Abstract switch and rotate into generic 'next' for cyclic datastructures