Project Wonder 5.0

com.webobjects.foundation
Class NSMutableDictionary<K,V>

java.lang.Object
  extended by com.webobjects.foundation.NSDictionary<K,V>
      extended by com.webobjects.foundation.NSMutableDictionary<K,V>
All Implemented Interfaces:
_NSFoundationCollection, NSCoding, NSKeyValueCoding, NSKeyValueCodingAdditions, Serializable, Cloneable, Map<K,V>
Direct Known Subclasses:
ERXMutableDictionary, ERXWOXMLCoder.XMLData

public class NSMutableDictionary<K,V>
extends NSDictionary<K,V>

NSMutableDictionary reimplementation to support JDK 1.5 templates and the proper collection methods. Use with

 NSMutableDictionary<String, String> env = new NSMutableDictionary<String, String>(System.getenv(), true);
 
 for (String key : env)
        logger.debug(env.valueForKey(key));
 

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.webobjects.foundation.NSDictionary
NSDictionary._JavaNSDictionaryMapEntry<P,Q>
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSCoding
NSCoding._BigDecimalSupport, NSCoding._BigIntegerSupport, NSCoding._BooleanSupport, NSCoding._ByteSupport, NSCoding._CharacterSupport, NSCoding._DateSupport, NSCoding._DoubleSupport, NSCoding._FloatSupport, NSCoding._IntegerSupport, NSCoding._LongSupport, NSCoding._NumberSupport, NSCoding._ShortSupport, NSCoding._StringSupport, NSCoding.Support
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
 
Nested classes/interfaces inherited from interface com.webobjects.foundation.NSKeyValueCoding
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.MapImplementation, NSKeyValueCoding.Null<T>, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
static Class _CLASS
           
 
Fields inherited from class com.webobjects.foundation.NSDictionary
_capacity, _count, _deletionLimit, _entrySetCache, _flags, _hashCache, _hashtableBuckets, _keys, _keysCache, _keySetCache, _MAP_ENTRY_CLASS, _NSDictionaryClassHashCode, _NSDictionaryMapEntryHashCode, _objects, _objectsCache, CheckForNull, EmptyDictionary, IgnoreNull
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
_KeyPathSeparatorChar, KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Constructor Summary
NSMutableDictionary()
           
NSMutableDictionary(Dictionary<? extends K,? extends V> dictionary, boolean ignoreNull)
           
NSMutableDictionary(int capacity)
           
NSMutableDictionary(Map<? extends K,? extends V> map)
           
NSMutableDictionary(Map<? extends K,? extends V> map, boolean ignoreNull)
           
NSMutableDictionary(NSArray<? extends V> objects, NSArray<? extends K> keys)
           
NSMutableDictionary(NSDictionary<? extends K,? extends V> otherDictionary)
           
NSMutableDictionary(V[] objects, K[] keys)
           
NSMutableDictionary(V object, K key)
           
 
Method Summary
 void addEntriesFromDictionary(NSDictionary<? extends K,? extends V> otherDictionary)
           
 void clear()
          Remove all mappings from this map.
 Object clone()
           
 NSDictionary<K,V> immutableClone()
           
 NSMutableDictionary<K,V> mutableClone()
           
 V put(K key, V value)
          Associate the value with key in this map.
 void putAll(Map<? extends K,? extends V> m)
          Copy all mappings from m to this map.
 V remove(Object key)
          Remove mapping for key from this map if it is present.
 void removeAllObjects()
           
 V removeObjectForKey(Object key)
           
 void removeObjectsForKeys(NSArray<? extends K> keys)
           
 void setDictionary(NSDictionary<? extends K,? extends V> otherDictionary)
           
 void setObjectForKey(V object, K key)
           
 void takeValueForKey(Object value, String key)
           
 Collection<V> values()
          Return a collection view of the values contained in this map.
 
Methods inherited from class com.webobjects.foundation.NSDictionary
_clearDeletionsAndCollisions, _ensureCapacity, _initializeDictionary, _shallowHashCode, allKeys, allKeysForObject, allValues, classForCoder, containsKey, containsValue, count, decodeObject, emptyDictionary, encodeWithCoder, entrySet, equals, get, hashCode, hashMap, hashtable, isEmpty, isEqualToDictionary, keyEnumerator, keySet, keysNoCopy, objectEnumerator, objectForKey, objectsForKeys, objectsNoCopy, size, takeValueForKeyPath, toString, valueForKey, valueForKeyPath
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_CLASS

public static final Class _CLASS
Constructor Detail

NSMutableDictionary

public NSMutableDictionary()

NSMutableDictionary

public NSMutableDictionary(int capacity)

NSMutableDictionary

public NSMutableDictionary(V object,
                           K key)

NSMutableDictionary

public NSMutableDictionary(V[] objects,
                           K[] keys)

NSMutableDictionary

public NSMutableDictionary(NSArray<? extends V> objects,
                           NSArray<? extends K> keys)

NSMutableDictionary

public NSMutableDictionary(NSDictionary<? extends K,? extends V> otherDictionary)

NSMutableDictionary

public NSMutableDictionary(Dictionary<? extends K,? extends V> dictionary,
                           boolean ignoreNull)

NSMutableDictionary

public NSMutableDictionary(Map<? extends K,? extends V> map)

NSMutableDictionary

public NSMutableDictionary(Map<? extends K,? extends V> map,
                           boolean ignoreNull)
Method Detail

setObjectForKey

public void setObjectForKey(V object,
                            K key)

removeObjectForKey

public V removeObjectForKey(Object key)

removeAllObjects

public void removeAllObjects()

setDictionary

public void setDictionary(NSDictionary<? extends K,? extends V> otherDictionary)

addEntriesFromDictionary

public void addEntriesFromDictionary(NSDictionary<? extends K,? extends V> otherDictionary)

removeObjectsForKeys

public void removeObjectsForKeys(NSArray<? extends K> keys)

takeValueForKey

public void takeValueForKey(Object value,
                            String key)
Specified by:
takeValueForKey in interface NSKeyValueCoding
Overrides:
takeValueForKey in class NSDictionary<K,V>

clone

public Object clone()
Overrides:
clone in class NSDictionary<K,V>

immutableClone

public NSDictionary<K,V> immutableClone()
Overrides:
immutableClone in class NSDictionary<K,V>

mutableClone

public NSMutableDictionary<K,V> mutableClone()
Overrides:
mutableClone in class NSDictionary<K,V>

put

public V put(K key,
             V value)
Associate the value with key in this map. If the map previously contained a mapping for key, the old value will be replaced by value.

Specified by:
put in interface Map<K,V>
Overrides:
put in class NSDictionary<K,V>
Parameters:
key - key to associate value with
value - vaue to be associated with key
Returns:
previous value associated with specified key, or null if there was no mapping for key.

remove

public V remove(Object key)
Remove mapping for key from this map if it is present.

Specified by:
remove in interface Map<K,V>
Overrides:
remove in class NSDictionary<K,V>
Parameters:
key - key whose mapping is to be removed from the map.
Returns:
previous value associated with key, or null if there was no mapping for key.

putAll

public void putAll(Map<? extends K,? extends V> m)
Copy all mappings from m to this map.

Specified by:
putAll in interface Map<K,V>
Overrides:
putAll in class NSDictionary<K,V>
Parameters:
m - Mappings to be stored in this map.

clear

public void clear()
Remove all mappings from this map.

Specified by:
clear in interface Map<K,V>
Overrides:
clear in class NSDictionary<K,V>

values

public Collection<V> values()
Return a collection view of the values contained in this map.

Specified by:
values in interface Map<K,V>
Overrides:
values in class NSDictionary<K,V>

Last updated: Wed, Feb 22, 2012 • 07:00 AM EST

Copyright © 2002 – 2011 Project Wonder.