// remove : voidfunc(K) static LinkedHashMap expiringHelperMap(final int timeOut, fO remove) { ret new LinkedHashMap() { protected bool removeEldestEntry(Map.Entry eldest) { long time = now(); if (time - eldest.getValue() > timeOut) { Iterator> i = entrySet().iterator(); Map.Entry e = i.next(); do { i.remove(); pcallF(remove, e.getKey()); } while (i.hasNext() && time - (e = i.next()).getValue() > timeOut); } false; } }; }