I am working on a program for one of my courses and am having difficulty with certain parts. The Sorcerer’s Cave game: Our goal with this project is to… First, implement a solid GUI interface to control and display the results of this program. Read a text data file, instantiate appropriate classes, create an internal data structure (multi-tree), display the structure in a convincing way using a JTextArea, and finally to search the structure (by index name and type).
I am having issues determining how to search my program. I have my information stored in ArrayLists. The point of this project is not to do the best possible way, but to build this program over the course of the semester. In this project we are supposed to iterate through the arraylist to find the required information, a slow but effective method.
What is the best way to implement this type of searching into my program? Will I store the search text as a string and compare that string to each element of the array list(s)? Would something like myList.indexOf(string) work for these purposes? Where string is the user input search term. Then I can use that index generated by indexOf to generate the searched items? Any help will be greatly appreciated.