--- android/TrainInfo/src/dk/thoerup/traininfo/util/AndroidTimeoutCache.java 2010/09/08 09:29:42 1032 +++ android/TrainInfo/src/dk/thoerup/traininfo/util/AndroidTimeoutCache.java 2010/09/08 10:23:44 1033 @@ -16,6 +16,10 @@ lastupdate = android.os.SystemClock.elapsedRealtime(); } + public boolean isExpired(long now) { + return ( (lastupdate+timeout) < now); + } + public long lastupdate; public T value; } @@ -38,7 +42,7 @@ K key = it.next(); CacheItem item = cache.get(key); - if ( (item.lastupdate+timeout) < now) { //item too old + if ( item.isExpired(now)) { //item too old it.remove(); //Log.e("Purge", "removing"); } @@ -58,7 +62,7 @@ if (item != null) { - if ( (item.lastupdate+timeout) < now) { //item too old + if ( item.isExpired(now) ) { //item too old return null; } else { return item.value; //item still good