Hi again. I just wrote here to ask for a little help yesterday, so I got the help and worked that out, and I'm just curious about something I am going to do in the following couple of days, as soon as I work the network part of this project. The thing is - my program about (simple)voting should show the results to all of the clients at the end of the voting(when all of the clients finished voting), but it also says the following: "The server offers a review of all the previous voting results". I understand that as - I should store every voting's results in some data structure so I could get them anytime I want. But I can only think of a database right now as a tool to achieve this. So, my question is - is a database the only choice or I am missing something? I think the teachers said that we should not use databases, but I'm not quite sure. Can you point me at the right direction of the database alternatives? And please make it something easy, I've had enough thinking already :)

Write the data to a file or a bunch of files in one or more directories.
Depends on update and retrieval requirements.

If you get all your results into some object (eg an ArrayList<Result>) then it's very easy to write/read the whole object to/from a file in a single staement using ObjectOutputStream/ObjectInputStream. That's probably the easiest way if you don't need to do record-based I/O

Well thanks, I thought about writing to a file, but I wanted to make sure that's the best and probably only alternative. Does that mean that none of the data structures offer persistent storage, I mean - this may be a stupid question, but where are ArrayList/LinkedList and other objects stored? Aren't they stored on the disc(secondary memory)?

Edited 6 Years Ago by robertmacedonia: n/a

This question has already been answered. Start a new discussion instead.