From e911874e72a6ebe0844f516026cd51adf8bbb820 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 10 Jun 2019 21:43:38 +0200 Subject: [PATCH] Make MultiMap use generics where sensible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I wonder why I orginally did not do it that way… --- .../java/org/jivesoftware/smack/util/MultiMap.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/MultiMap.java b/smack-core/src/main/java/org/jivesoftware/smack/util/MultiMap.java index 334695982..0908106c2 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/MultiMap.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/MultiMap.java @@ -77,11 +77,11 @@ public class MultiMap { return map.isEmpty(); } - public boolean containsKey(Object key) { + public boolean containsKey(K key) { return map.containsKey(key); } - public boolean containsValue(Object value) { + public boolean containsValue(V value) { for (List list : map.values()) { if (list.contains(value)) { return true; @@ -96,7 +96,7 @@ public class MultiMap { * @param key * @return the first value or null. */ - public V getFirst(Object key) { + public V getFirst(K key) { List res = getAll(key); if (res.isEmpty()) { return null; @@ -114,7 +114,7 @@ public class MultiMap { * @param key * @return all values for the given key. */ - public List getAll(Object key) { + public List getAll(K key) { List res = map.get(key); if (res == null) { res = Collections.emptyList(); @@ -143,7 +143,7 @@ public class MultiMap { * @param key * @return the first value of the given key or null. */ - public V remove(Object key) { + public V remove(K key) { List res = map.remove(key); if (res == null) { return null; @@ -162,7 +162,7 @@ public class MultiMap { * @param value * @return true if the mapping was removed, false otherwise. */ - public boolean removeOne(Object key, V value) { + public boolean removeOne(K key, V value) { List list = map.get(key); if (list == null) { return false;