Java Collection 已满时将哪些页面写入磁盘? [英] Java Collection which pages to disk when it gets full?

查看:16
本文介绍了Java Collection 已满时将哪些页面写入磁盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一位同事提到他听说过一个轻量级集合,当它的内容太满时,它会自动分页到磁盘 - 但他不记得名字了.我想它看起来像这样:

A colleague mentioned that he heard about a lightweight collection which would automatically page out to disk when it's contents got too full - but he couldn't remember the name. I would imagine it looks something like this:

PagingCollection<Serializable> pagingCollection = new PagingArrayList<>();
pagingCollection.setMaxSizeInMemory(500);
for (int x = 0; x < 1000; x++) { pagingcollection.add("x="+x); }

然后将 x=0 到 x=500 推送到磁盘.关键是能够在不将整个内容加载到内存中的情况下对其进行迭代..

Which would then push x=0 to x=500 to disk. The key would be being able to iterate over it without loading the whole thing into memory..

这适用于内存量较低的胖客户端.

This is for a thick client with low amounts of memory.

有人知道它(或类似的东西)吗?

Does anyone know of it (or something similar)?

推荐答案

嗯,我所知道的唯一具有这种功能的工具是流行系统:prevaylerspace4j(后者似乎没有更多一个专用网站,但仍然可用......在 Sourceforge 上).尽管它们的界面一开始会让您觉得很奇怪,但它们使用起来非常简单,并提供了方便的功能集.

Well, the only tools I know that has this kind of features are the prevalence systems : prevayler and space4j (the later seems to no more have a dedicated website, but to be still available ... on Sourceforge). Although their interface will seems weird to you at first, they are however quite simple to use and offer a convenient feature set.

这篇关于Java Collection 已满时将哪些页面写入磁盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆