can the linked list store like a list of information? eg a booking List with the index as its booking number, can each index store like a whole chunk of info? eg name, contact, status, size, date, time,..? and how do i retrieve the info stored by the booking number? like if i wanted to edit the status, do i use the set(int index, Object element)? what does this Object here mean?
posted 11 years ago
can the linked list store like a list of information? eg a booking List with the index as its booking number, can each index store like a whole chunk of info? ... and how do i retrieve the info stored by the booking number?
What you actually want is a java.util.Map. A Map associates keys - in this case the booking number - with Objects containing chunks of information. What you do is create a Class that stores all the information you need, something like:
You'd also add functions to the class that would allow you to access and change the information. The Map would then contain a bunch of Booking_Data objects, each with the information for a different booking. To change information, you would get the object from the list using the booking number, then change the information in the object using the functions you wrote. You might want to pick up a book on Java for more details. I started with "Java in a Nutshell", which is published by O'Reilly. Or if what you really want is to be a travel agent rather than a programmer, you might consider hiring a programmer to help you.