aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/utils
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2013-01-13 10:30:57 +0100
committerBananeweizen <bananeweizen@gmx.de>2013-01-13 10:30:57 +0100
commited7eaa1b52063cb46e9b2e0281da115ca05f9677 (patch)
tree022f73dce9243977359e3eb02ecf6f916501f29d /main/src/cgeo/geocaching/utils
parent9c62d0a0d10a7345210b2d06da5dbc126c68977e (diff)
parent89bd78c4e3233788a3910443b1d7de3d2857c7c6 (diff)
downloadcgeo-ed7eaa1b52063cb46e9b2e0281da115ca05f9677.zip
cgeo-ed7eaa1b52063cb46e9b2e0281da115ca05f9677.tar.gz
cgeo-ed7eaa1b52063cb46e9b2e0281da115ca05f9677.tar.bz2
Merge remote-tracking branch 'origin/release'
Conflicts: main/src/cgeo/geocaching/maps/CGeoMap.java
Diffstat (limited to 'main/src/cgeo/geocaching/utils')
-rw-r--r--main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java
index aafce4f..698d38a 100644
--- a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java
+++ b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java
@@ -9,7 +9,7 @@ import java.util.List;
/**
* Synchronized set wrapper for the LeastRecentlyUsedMap.
- *
+ *
* This code is heavily based on the HashSet code that represent Map as a Set.
* Unfortunately HashSet does not allow to use a custom Map as its Storage.
* Therefore overriding removeEldestEntry() is impossible for a normal LinkedHashSet.
@@ -50,7 +50,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E>
/**
* Synchronized access to set size
* Copy of the HashSet code if size()
- *
+ *
* @see HashSet
*/
@Override
@@ -61,7 +61,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E>
/**
* Synchronized check of set emptiness
* Copy of the HashSet code if isEmpty()
- *
+ *
* @see HashSet
*/
@Override
@@ -72,7 +72,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E>
/**
* Synchronized check for containment
* Copy of the HashSet code if contains()
- *
+ *
* @see HashSet
*/
@Override
@@ -83,18 +83,21 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E>
/**
* Synchronized addition of an item
* Copy of the HashSet code if add()
- *
+ *
* @see HashSet
*/
@Override
public synchronized boolean add(E e) {
+ if (e == null) {
+ throw new IllegalArgumentException("LeastRecentlyUsedSet cannot take null element");
+ }
return map.put(e, PRESENT) == null;
}
/**
* Synchronized removal of a contained item
* Copy of the HashSet code if remove()
- *
+ *
* @see HashSet
*/
@Override
@@ -117,7 +120,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E>
/**
* Synchronized clearing of the set
* Copy of the HashSet code if clear()
- *
+ *
* @see HashSet
*/
@Override
@@ -128,7 +131,7 @@ public class LeastRecentlyUsedSet<E> extends AbstractSet<E>
/**
* (synchronized) Clone of the set
* Copy of the HashSet code if clone()
- *
+ *
* @see HashSet
*/
@Override