This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I am using LinkedList's as part of java.util in an A-Star search. Is there a limit to the amount of values you can insert into a LinkedList? I thought that it expands its capacity as you insert values. Here's a example of the output:
The neighbors should be added to the open list, but at some point are stopped being added. I can provide some code if need be. I'm just wondering if its something I'm just not aware about dealing with LinkedList. Thanks
Please surround your code with [ CODE ] ... [ /CODE ] tags to keep the indentation. That's a bit of code to trudge through without indenting; can you give us an idea of where the problem lies? At least tell us which method is exhibiting the problem (produces erroneous output).
With regard to LinkedList, Horatio is correct: LinkedList is bound by memory only. Well, Collection.size() returns an int, so I suppose it's also bound by Integer.MAX_VALUE. You were thinking of ArrayList that has a capacity that is increased when it is reached, though it's still bound by the same two things as LinkedList.
Joined: Feb 23, 2005
I'll try and have a look at this tomorrow, if you can wait. In the mean time, there is an here article on java A* implementations.
Joined: Feb 27, 2005
Ok, thanks allot for the replies. Sorry for the ugly code post, I'm new to the forums and didn't know how to best paste the code in. The article seems to be very informative, thank you. I know my issue lies in my lack of experience with java, rather than my understanding of the alogrithm. This certainly helps close the gap. Thanks!