diff options
Diffstat (limited to 'src/net/pacien')
-rw-r--r-- | src/net/pacien/util/IntrinsicMap.java | 10 | ||||
-rw-r--r-- | src/net/pacien/util/Mappable.java | 4 |
2 files changed, 5 insertions, 9 deletions
diff --git a/src/net/pacien/util/IntrinsicMap.java b/src/net/pacien/util/IntrinsicMap.java index fe59ac2..c09965d 100644 --- a/src/net/pacien/util/IntrinsicMap.java +++ b/src/net/pacien/util/IntrinsicMap.java | |||
@@ -1,6 +1,3 @@ | |||
1 | /** | ||
2 | * | ||
3 | */ | ||
4 | package net.pacien.util; | 1 | package net.pacien.util; |
5 | 2 | ||
6 | import java.util.Collection; | 3 | import java.util.Collection; |
@@ -11,12 +8,12 @@ import java.util.Map; | |||
11 | * @author pacien | 8 | * @author pacien |
12 | * | 9 | * |
13 | */ | 10 | */ |
14 | public class IntrinsicMap<K, V extends Mappable> extends HashMap<K, V> { | 11 | public class IntrinsicMap<K, V extends Mappable<K>> extends HashMap<K, V> { |
15 | 12 | ||
16 | /** | 13 | /** |
17 | * | 14 | * |
18 | */ | 15 | */ |
19 | private static final long serialVersionUID = 1L; | 16 | private static final long serialVersionUID = 804991277001317260L; |
20 | 17 | ||
21 | /** | 18 | /** |
22 | * | 19 | * |
@@ -47,9 +44,8 @@ public class IntrinsicMap<K, V extends Mappable> extends HashMap<K, V> { | |||
47 | super(initialCapacity, loadFactor); | 44 | super(initialCapacity, loadFactor); |
48 | } | 45 | } |
49 | 46 | ||
50 | @SuppressWarnings("unchecked") | ||
51 | public V put(final V value) { | 47 | public V put(final V value) { |
52 | return super.put((K) value.getKey(), value); | 48 | return super.put(value.getKey(), value); |
53 | } | 49 | } |
54 | 50 | ||
55 | @Override | 51 | @Override |
diff --git a/src/net/pacien/util/Mappable.java b/src/net/pacien/util/Mappable.java index b5bbf06..804a275 100644 --- a/src/net/pacien/util/Mappable.java +++ b/src/net/pacien/util/Mappable.java | |||
@@ -1,7 +1,7 @@ | |||
1 | package net.pacien.util; | 1 | package net.pacien.util; |
2 | 2 | ||
3 | public interface Mappable { | 3 | public interface Mappable<K> { |
4 | 4 | ||
5 | public Object getKey(); | 5 | public K getKey(); |
6 | 6 | ||
7 | } | 7 | } |