diff options
| author | Benjamin Culkin <scorpress@gmail.com> | 2024-07-01 17:27:48 -0400 |
|---|---|---|
| committer | Benjamin Culkin <scorpress@gmail.com> | 2024-07-01 17:27:48 -0400 |
| commit | 02bc52037e9ccccca672d6156d9c325c74fe28b3 (patch) | |
| tree | db022b83c90562f461f4a27412caa9936a8dfd04 /projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java | |
| parent | c75d7dbd613a47b217499f7a856c469a8bc59e2a (diff) | |
Update a whole bunch of things
Yeah... not a great commit message. t.b.h, I could maybe've split the
commit into more parts; but that would be quite a lot off effort and
would have a pretty decent chance of at least one of the commits leaving
the repository in a non-working state.
For the future, will want to try and commit more often so there aren't
these mega-commits where it's just "a whole bunch of stuff changed"
Diffstat (limited to 'projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java')
| -rw-r--r-- | projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java b/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java index ba58189..99c5230 100644 --- a/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java +++ b/projects/net.wotonomy.foundation/src/main/java/net/wotonomy/foundation/NSMutableDictionary.java @@ -29,7 +29,9 @@ import java.util.Map; * @author $Author: cgruber $ * @version $Revision: 893 $ */ -public class NSMutableDictionary extends NSDictionary { +public class NSMutableDictionary<K, V> extends NSDictionary<K, V> { + private static final long serialVersionUID = -150787274911739812L; + /** * Default constructor produces an empty dictionary. */ @@ -47,7 +49,7 @@ public class NSMutableDictionary extends NSDictionary { /** * Produces a dictionary that contains one key referencing one value. */ - public NSMutableDictionary(Object key, Object value) { + public NSMutableDictionary(K key, V value) { super(key, value); } @@ -55,21 +57,21 @@ public class NSMutableDictionary extends NSDictionary { * Produces a dictionary containing the specified keys and values. An * IllegalArgumentException is thrown if the arrays are not of the same length. */ - public NSMutableDictionary(Object[] keys, Object[] values) { - super(keys, values); + public NSMutableDictionary(K[] keys, V[] values) { + super(values, keys); } /** * Produces a dictionary that is a copy of the specified map (or dictionary). */ - public NSMutableDictionary(Map aMap) { + public NSMutableDictionary(Map<K, V> aMap) { super(aMap); } /** * Removes the key-value pair for the specified key. */ - public void removeObjectForKey(Object aKey) { + public void removeObjectForKey(K aKey) { remove(aKey); } @@ -77,7 +79,7 @@ public class NSMutableDictionary extends NSDictionary { * Copies all mappings from the specified dictionary to this dictionary, * replacing any mappings this map had for any keys in the specified map. */ - public void addEntriesFromDictionary(Map aMap) { + public void addEntriesFromDictionary(Map<K, V> aMap) { putAll(aMap); } @@ -91,8 +93,8 @@ public class NSMutableDictionary extends NSDictionary { /** * Removes all keys in the specified array from this dictionary. */ - public void removeObjectsForKeys(NSArray anArray) { - Enumeration enumeration = anArray.objectEnumerator(); + public void removeObjectsForKeys(NSArray<K> anArray) { + Enumeration<K> enumeration = anArray.objectEnumerator(); while (enumeration.hasMoreElements()) { removeObjectForKey(enumeration.nextElement()); } @@ -102,7 +104,7 @@ public class NSMutableDictionary extends NSDictionary { * Clears all mappings in this dictionary and then adds all entries in the * specified dictionary. */ - public void setDictionary(Map aMap) { + public void setDictionary(Map<K, V> aMap) { removeAllObjects(); addEntriesFromDictionary(aMap); } @@ -112,7 +114,7 @@ public class NSMutableDictionary extends NSDictionary { * dictionary, the old value is replaced with the specified value. An * IllegalArgumentException is thrown if either the key or value is null. */ - public void setObjectForKey(Object aValue, Object aKey) { + public void setObjectForKey(V aValue, K aKey) { if ((aKey == null) || (aValue == null)) { throw new IllegalArgumentException("Cannot use null objects with an NSMutableDictionary."); } |
