Data Read the stdlib: deque By Bob Belderbos on 20 December 2016 Use collections.deque to rotate letters in string (or elements in list). It has a native method which performs faster too.