assertEquals("Size == 0 after gc", 0, map.size());
}
private void forceSoftRefCollection()
{
ReferenceQueue queue = new ReferenceQueue();
SoftReference reference = new SoftReference(new Object(), queue);
ArrayList list = new ArrayList();
try
{
Random rnd = new Random();
for(int i = 0; true; i ++)
{
BigInteger bi = new BigInteger(16384, rnd);
list.add(bi);
if (i%1000==0)
{
Reference ref;
if ( (ref = queue.poll()) != null)
{
System.out.println("Break as the soft reference has been queued: "+ref);
break;
}
}