diff options
author | Stephan Schwaer | 2015-10-29 13:58:39 +0100 |
---|---|---|
committer | Stephan Schwaer | 2015-10-29 13:58:39 +0100 |
commit | 8204d3412245fd50578f948747a19722126915e6 (patch) | |
tree | 02dfbb57bd447b289f99be756091e0a207eb24a0 /dozentenmodul/src/main/java/org/openslx/dozmod/util | |
parent | [client] Fix appearance of lecture and resulting NPE after deleting image the... (diff) | |
download | tutor-module-8204d3412245fd50578f948747a19722126915e6.tar.gz tutor-module-8204d3412245fd50578f948747a19722126915e6.tar.xz tutor-module-8204d3412245fd50578f948747a19722126915e6.zip |
[client] Make MapHelper null safe and do lectureCache refresh with QuickTimer after deleting image.
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/util')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/util/MapHelper.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/MapHelper.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/MapHelper.java index e99b1aa6..487a9ac6 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/util/MapHelper.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/MapHelper.java @@ -11,9 +11,14 @@ public class MapHelper { private static final Logger LOGGER = Logger.getLogger(MapHelper.class); - private MapHelper() {} + private MapHelper() { + } public static <T> boolean hasChanged(final Map<String, T> oldMap, final Map<String, T> newMap) { + if (oldMap == null && newMap == null) + return false; + if ((oldMap == null && newMap != null) || (oldMap != null && newMap == null)) + return true; // build list of users that were added, if any return true if (oldMap.size() != newMap.size()) return true; @@ -28,11 +33,13 @@ public class MapHelper { // everything was the same if we are still here return false; } + private static <T> Set<String> getAddedUsers(final Map<String, T> oldMap, final Map<String, T> newMap) { Set<String> addedUsers = new HashSet<String>(newMap.keySet()); addedUsers.removeAll(oldMap.keySet()); return addedUsers; } + private static <T> Set<String> getRemovedUsers(final Map<String, T> oldMap, final Map<String, T> newMap) { Set<String> removedUsers = new HashSet<String>(oldMap.keySet()); removedUsers.removeAll(newMap.keySet()); |