fix accidental memory leak
This commit is contained in:
parent
51fdd8f38a
commit
339b52227b
1 changed files with 3 additions and 3 deletions
|
@ -320,14 +320,14 @@ public class TravelingItem {
|
|||
|
||||
public static class TravelingItemCache {
|
||||
|
||||
private final IntHashMap itemCache = new IntHashMap();
|
||||
private final Map<Integer, TravelingItem> itemCache = new MapMaker().weakValues().makeMap();
|
||||
|
||||
public void cache(TravelingItem item) {
|
||||
itemCache.addKey(item.id, item);
|
||||
itemCache.put(item.id, item);
|
||||
}
|
||||
|
||||
public TravelingItem get(int id) {
|
||||
return (TravelingItem) itemCache.lookup(id);
|
||||
return itemCache.get(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue