diff options
Diffstat (limited to 'main/src/cgeo/geocaching/gcvote/GCVote.java')
-rw-r--r-- | main/src/cgeo/geocaching/gcvote/GCVote.java | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/gcvote/GCVote.java b/main/src/cgeo/geocaching/gcvote/GCVote.java index d0517f3..0d7f202 100644 --- a/main/src/cgeo/geocaching/gcvote/GCVote.java +++ b/main/src/cgeo/geocaching/gcvote/GCVote.java @@ -1,5 +1,6 @@ package cgeo.geocaching.gcvote; +import cgeo.geocaching.Cache; import cgeo.geocaching.Parameters; import cgeo.geocaching.Settings; import cgeo.geocaching.cgBase; @@ -12,7 +13,6 @@ import android.util.Log; import java.util.ArrayList; import java.util.HashMap; -import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; @@ -27,16 +27,8 @@ public final class GCVote { private static final Pattern patternVote = Pattern.compile("voteUser='([0-9.]+)'", Pattern.CASE_INSENSITIVE); private static final Pattern patternVoteElement = Pattern.compile("<vote ([^>]+)>", Pattern.CASE_INSENSITIVE); - private static class RatingsCache extends LinkedHashMap<String, GCVoteRating> { - private static final int MAX_CACHED_RATINGS = 1000; - - @Override - protected boolean removeEldestEntry(java.util.Map.Entry<String, GCVoteRating> eldest) { - return size() > MAX_CACHED_RATINGS; - } - } - - private static Map<String, GCVoteRating> ratingsCache = new RatingsCache(); + private static final int MAX_CACHED_RATINGS = 1000; + private static Cache<String, GCVoteRating> ratingsCache = new Cache<String, GCVoteRating>(MAX_CACHED_RATINGS); /** * Get user rating for a given guid or geocode. For a guid first the ratings cache is checked |