aspose file tools*
The moose likes Beginning Java and the fly likes Howto : maitain and update a table in memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Howto : maitain and update a table in memory" Watch "Howto : maitain and update a table in memory" New topic
Author

Howto : maitain and update a table in memory

achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
Hi.
I've to create a table or an array list in memory, other applets will be writing to it and updating it. The records in the table will eventually be flushed to database.
Currently I am using String[] in an applet to hold these data, but everytime another applet calls this singleton, it flushes all the old data and start from scratch i.e. index at 0.
Can someone suggest some workable solution on how to create and update a table in memory please.
TIA :-)


humanum errare est.
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Have you looked at the Collections classes in java.util? For example there is java.util.HashTable, java.util.HashSet (Which is a Hash Table implementation that uses a Set Interface) and java.util.HashMap (which is a hash table based implementation of the Map interface). Take a look at the Sun API or another resource on the Collection classes.
achana chan
Ranch Hand

Joined: Jul 29, 2002
Posts: 277
I hope they allow multiple applets to update and insert into them without flushing the old data and resetting the index everytime an applet accesses it?
Thanks for the tip.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Just curious ... how did you store your array in memory so that "other applets" can get to it? What does the code look like that gets a reference to the array? Maybe you're inadvertantly creating a new table every time through.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
 
subject: Howto : maitain and update a table in memory