So I'm using an ArrayList (to create a hash table structure) like so:
protected ArrayList bucketArray;
Later in the constructor, it initializes it as:
bucketArray = new ArrayList(500);
When I use it and try to insert a Node from a linked list in like this:
it gives me the error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 347, Size: 0
Shouldn't the size be set as 500 such that I can insert at any given location? If I change it to just add without a location, it'll append to the ArrayList perfectly fine but not in the order I need for a hash table obviously. Any suggestions in what I can do to resolve this?
Thanks for the help!