Forums - Open Redstone Engineers
Need Java Help - Printable Version

+- Forums - Open Redstone Engineers (https://forum.openredstone.org)
+-- Forum: Off-Topic (https://forum.openredstone.org/forum-4.html)
+--- Forum: Programming (https://forum.openredstone.org/forum-8.html)
+--- Thread: Need Java Help (/thread-6931.html)



Need Java Help - ddthj - 07-04-2015

So I have an arraylist of objects, and I'm trying to save it to a file so that when the program loads again it can read the list from the file and keep going where it left off. 

The problem is that I have no experience in java and apparently no one on the internet has ever tried to save an arraylist of objects to a file.

Any Ideas?


RE: Need Java Help - Chibill - 07-04-2015

Well there are many ways to do this. What exactly would the objects contain in general?


RE: Need Java Help - Magazorb - 07-04-2015

simplest way i can think of doing it is just using for loops to write it down 1 element at a time, and then do the same thing to read it back, this is pretty much the slowest way to do things.


RE: Need Java Help - ddthj - 07-04-2015

(07-04-2015, 05:17 AM)Chibill Wrote: Well there are many ways to do this. What exactly would the objects contain in general?

The objects that are in the allraylist have a few variables and a function


RE: Need Java Help - ddthj - 07-04-2015

(07-04-2015, 03:35 PM)Magazorb Wrote: simplest way i can think of doing it is just using for loops to write it down 1 element at a time, and then do the same thing to read it back, this is pretty much the slowest way to do things.

This didn't appear to work since I have objects in the arraylist


RE: Need Java Help - tokumei - 07-04-2015

Give us the general structure of the object. What are the fields and their types? Ambiguity is not helpful in this field.


RE: Need Java Help - Chibill - 07-04-2015

Might be able to serialize it or something...