I really shouted at my computer, but that doesn't transmit at all well across thousands of miles
Jesse Silverman wrote:. . . two things that Campbell said rather passively
Maybe they thought nobody would need it. There is a Collections#rotate(List, int) method, so you can create a List, rotate it, and use its toArray() method. But I think the idea of this sort of exercise is to write a rotate method by hand. As you said, I would prefer to see it generalised.
. . .the Arrays helper class that they don't have one to rotate left or right . . .
Carey Brown wrote:From my C/C++ days I had a method declared like this that would detect which way the overlap (if any) went and would use the appropriate ascending or descending move. A length would be specified which could be more than one.
Jesse Silverman wrote:Code that gets called tons and almost nobody looks at it, not so much.
That is what I would have thought; it also allows for negative shifts, which means rotation to the
Jesse Silverman wrote:. . . modulo the length? . . .