I don't know what ADTList is, but you can specify an initial capacity for ArrayList in the constructor. It grows according to its own logic and doesn't give you any way to control that. I figure it's smarter than I am so that doesn't bother me.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: Oct 13, 2006
I've tried everything I can think of to do that. The only way I could even test my program was by importing java.util.ArrayList. So now the program doesn't even use my class I created. Like I said before, I created the ArrayList, ArrayList array = new Arraylist() and everytime I try and use my add or set method I get a null pointer Exception. Here's the class code:
I would make your class have a different name than ArrayList, perhaps MyArrayList, or ATDArrayList. It is very confusing (to a coder) to use the same class name as another class.
Then I would try stepping into your functions with your compiler and see what is happening. My guess is that you created an ArrayList and not your own class and are somehow invoking your class on a null pointer.
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