List implementation that writes to disk

Anyone know of a List implementation that reads/writes the list contents to disk? We have an issue where a List will have over a million entries and get some OutOfMemroy errors. So I had this idea of writing a List implementation that has a certain threshold, let’s say 25000. After which point it will start Serializing objects to a file. I have some ideas on how to implement this but maybe something exists already, I haven’t found anything so I may have to write it myself.

Could EHCache help? If you use this then it’ll store whatever’s in the List up to 25000 instances and if it’s over then you overflow to disk. Maybe this will help.

<cache name=“cacheStrategy”
maxElementsInMemory=“25000”
eternal=“true”
overflowToDisk=“true”
maxElementsOnDisk=“10000000”
diskPersistent=“true”
/>

I’m not sure as I didn’t read too much into their site, but is this not a server thing? My project here is a Swing app so I’m not sure if this would help, but I’ll have to look into it more. It’s not a priority right now, but next week I’ll be working on this so I’ll see if it’s suitable for what we need.

Nope it’s not a server thing and you could use it as a stand alone.

Actually I think this will work, if anything it does way more than what I need but that’s ok. Thanks for the suggestion.

No problem. I used this for Hibernate & AOP Caching.