Matt, you will probably want to have an int instance variable in SurgeProtector, like int lastIndex, that keeps track of the lastIndex of the elements inserted into the array. Use that index value to add an element to the array and then increment lastIndex by 1. I'd recommend looking at the ArrayList source code in Java. I always find it fun to see how things are implemented and you can learn quite a bit. ArrayList essentially consists of an internal array, that is dynamically resized (rather, duplicated) when the size of the ArrayList exceeds the initial size of the internal array representation.
Joined: Feb 27, 2012
Got it! Thanks so much guys I'll get to work!
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com