Build Your Own CircularArrayList In Under 34 Minutes
See how we can create our own CircularArrayList by reusing the Collection framework abstract base classes.
In this mini-course, we learn how to build a CircularArrayList. Similar to a normal ArrayList, but with a head position that can change within the array. The normal ArrayList always has the head at position 0, making it inefficient to add or remove elements at the front. Since it is still based on an array, we have the benefit of constant time access. It is thus still a valid RandomAccess List implementation.
Heinz Kabutz is the author of The Java Specialists’ Newsletter, a publication enjoyed by tens of thousands of Java experts in over 145 countries. His book “Dynamic Proxies (in German)” was #1 Bestseller on Amazon.de in Fachbücher für Informatik for about five minutes until Amazon fixed their algorithm. Thanks to a supportive mother, he has now sold 5 copies.
Heinz’s Java Specialists’ newsletter is filled with amusing anecdotes of life on the Island of Crete. He is a popular speaker at all the best Java conferences around the world, and also at some of the worst. He teaches Java courses in classrooms around the world, where his prime objective is to make absolutely sure that none of his students fall asleep. He is not always successful.