Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Howto : maitain and update a table in memory

 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :-)
 
Mark Vedder
Ranch Hand
Posts: 624
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 277
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic