| Author |
ArrayList
|
Nidhi Kumar
Greenhorn
Joined: Jun 30, 2008
Posts: 1
|
|
hi, i have to use arraylist to store data throughout my application.how can i prevent arraylist from losing the previous data.do i need to initialize arraylist everytime whenever i call that file?? please give some suggestions. thanks in advance.
|
 |
Manuel Leiria
Ranch Hand
Joined: Jul 13, 2007
Posts: 171
|
|
|
I'm not sure what you want to do.Can you, please, elaborate?
|
Manuel Leiria<br /> <br />--------------<br />Peace cannot be kept by force; it can only be achieved by understanding. <br /> Albert Einstein
|
 |
Raghavan Muthu
Ranch Hand
Joined: Apr 20, 2006
Posts: 3327
|
|
Hello Nidhi kumar, Welcome to JavaRanch. ArrayList is yet another object and it does NOT lose its contents until and unless its elements are cleared off by calling the clear() method on the arraylist object . What exactly are you dealing with ? Can you paste some sample code or tell us more about what exactly you are doing? [ July 01, 2008: Message edited by: Raghavan Muthu ]
|
Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
|
 |
Gavin Tranter
Ranch Hand
Joined: Jan 01, 2007
Posts: 333
|
|
|
Is this topic not better off in the Beginner forum?
|
 |
Norm Radder
Ranch Hand
Joined: Aug 10, 2005
Posts: 681
|
|
|
To save data across invocations of your program you'll need to write the contents to a disk file at the end of the program and then read that file when you start the program.
|
 |
Rakesh Chaudhary
Ranch Hand
Joined: Feb 19, 2008
Posts: 118
|
|
Can't you use some different collection objects..... Or you are restricted to Arraylist
|
Acquire the unexpected.......
Preparing for SCJP 6
|
 |
Bert Bates
author
Sheriff
Joined: Oct 14, 2002
Posts: 8712
|
|
This might be better off in another forum but let's leave it here to breathe a little life into this one
|
Eliminate fossil fuel subsidies. (If you're not on the edge, you're taking up too much room.)
|
 |
 |
|
|
subject: ArrayList
|
|
|