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

Advanced collection class

 
shan raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to know is there any build in or third party collection class(to perform all operations in the collection interface) which can store the inserted items into the temp file if it exceeds the buffer size(e.g: 500). For e.g, if I am inserting 501 item into the collection class then it has to go into the file instead of having into the memory. While deleting the element in the memory, the element in the file has to be filled in the memory till it reaches the buffer size.

Thanks in Advance.
Shan
 
shan raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Second try !

Any one please suggest.

Regards
Shan
 
Campbell Ritchie
Sheriff
Pie
Posts: 50232
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I presume you have tried places like Jakarta Commons? I have never heard of such a class. You could have written your own in the time you were waiting for us to say "don't know".
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there is such a collection. Like Campbell said, you can create it yourself. Keep in mind that iterating may be harder than usual since you need to check the file as well. You will also run into synchronization problems if you try to read from the file and write to it at the same time.
 
shan raj
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you very much. I have started implementing my own custom collection class

one question here, when I use file better to keep the file stream object open for ever or open and close when ever it required.

Regards
Shan
 
Campbell Ritchie
Sheriff
Pie
Posts: 50232
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keeping it open will lock that file and preclude other code from accessing it. Also there may be a limit to how many file streams the JVM can support, so you might do well to close it if it is idle.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic