Daniel Gurianov wrote:Does anyone know what approach Collections.reverse() uses to reverse list?
My task is to implement and compare reverse methods from list and i already did reveres with Recursion, Swap, Reading backward with creating reversed copy.
Does Collections.reverse() use different approach from those i already did?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Tim Driven Development | Test until the fear goes away
Since Collections#reverse has void return type, it cannot produce a wrapper.Winston Gutkowski wrote: . . .
One possibility that might be worth considering is a "reversed wrapper" - . . .
… but there is a file in your Java® installation folder called src.zip. If you unzip that, you can find the source code and read it.You don't need to know that
Campbell Ritchie wrote:Since Collections#reverse has void return type, it cannot produce a wrapper.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Campbell Ritchie wrote:Not an in‑place technique, but have you ever tried a stack?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Campbell Ritchie wrote:Not an in‑place technique, but have you ever tried a stack?