Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Hardcoding an extremely large ArrayList?

807605Jun 22 2007 — edited Jun 22 2007
Hi everybody,
I've come up with a weird idea, and I have no clue if it's even remotely possible or rational, but here goes--

I have an extremely large arraylist, which is...let's see...an arraylist of arraylist of arraylist of arraylist. (whew!) Basically, it's 4 levels of an arraylist<String> nested, representing formatted sections of a paragraph, inside paragraphs, inside pages, inside chapters. I'd like to be able to hard-code this somehow into my program, so the user doesn't have to input the raw text file all the time. Basically, I'm looking to create a completely self-contained program, something like an ebook, which will eventually be wrapped in a .exe wrapper.

The only way I can think of to hard-code this big arraylist is to write every single call and insertion into each arraylist, which would take an extremely long time and be a real pain. I imagine that creating the arraylist when the program runs would be easier, like with a BufferedReader, but I don't know if there's a way to include a text file in a jar or class so it's self-contained and doesn't require any user input. Can anyone give me a hand with how, conceptually, I might be able to do this?

Thanks,
Jezzica85
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 20 2007
Added on Jun 22 2007
22 comments
493 views