Oop, now that I'm using Iterator.remove() in flush, we'd better get the
iterator directly from the delegate. (Wow, in the previous version (1.5) it was making a new Set, then making a new unmodifiable Set from that each time it iterated.) git-svn-id: https://samskivert.googlecode.com/svn/trunk@1145 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: LRUHashMap.java,v 1.6 2003/06/05 18:02:24 ray Exp $
|
// $Id: LRUHashMap.java,v 1.7 2003/06/05 18:18:12 ray Exp $
|
||||||
|
|
||||||
package com.samskivert.util;
|
package com.samskivert.util;
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ public class LRUHashMap implements Map
|
|||||||
if (_size > _maxSize) {
|
if (_size > _maxSize) {
|
||||||
// This works because the entrySet iterator of a LinkedHashMap
|
// This works because the entrySet iterator of a LinkedHashMap
|
||||||
// returns the entries in LRU order
|
// returns the entries in LRU order
|
||||||
Iterator iter = entrySet().iterator();
|
Iterator iter = _delegate.entrySet().iterator();
|
||||||
// don't remove the last entry, even if it's too big, because
|
// don't remove the last entry, even if it's too big, because
|
||||||
// a cache with nothing in it sucks
|
// a cache with nothing in it sucks
|
||||||
for (int ii=size(); (ii > 1) && (_size > _maxSize); ii--) {
|
for (int ii=size(); (ii > 1) && (_size > _maxSize); ii--) {
|
||||||
|
|||||||
Reference in New Issue
Block a user