Project Wonder 5.0

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

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

public class NSDictionary<K,V>
extends Object
implements Cloneable, Serializable, NSCoding, NSKeyValueCoding, NSKeyValueCodingAdditions, _NSFoundationCollection, Map<K,V>

NSDictionary reimplementation to support JDK 1.5 templates. Use with

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

See Also:
Serialized Form

Nested Class Summary
 class 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
protected  int _capacity
           
static Class _CLASS
           
protected  int _count
           
protected  int _deletionLimit
           
protected  Set<Map.Entry<K,V>> _entrySetCache
           
protected  byte[] _flags
           
protected  int _hashCache
           
protected  int _hashtableBuckets
           
protected  Object[] _keys
           
protected  Object[] _keysCache
           
protected  Set<K> _keySetCache
           
static Class _MAP_ENTRY_CLASS
           
protected static int _NSDictionaryClassHashCode
           
protected static int _NSDictionaryMapEntryHashCode
           
protected  Object[] _objects
           
protected  Object[] _objectsCache
           
static boolean CheckForNull
           
static NSDictionary EmptyDictionary
           
static boolean IgnoreNull
           
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
_KeyPathSeparatorChar, KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Constructor Summary
NSDictionary()
           
NSDictionary(Dictionary<? extends K,? extends V> dictionary, boolean ignoreNull)
           
NSDictionary(Map<? extends K,? extends V> map)
           
NSDictionary(Map<? extends K,? extends V> map, boolean ignoreNull)
           
NSDictionary(NSArray<? extends V> objects, NSArray<? extends K> keys)
           
NSDictionary(NSDictionary<? extends K,? extends V> otherDictionary)
           
NSDictionary(V[] objects, K[] keys)
           
NSDictionary(V object, K key)
           
 
Method Summary
protected  void _clearDeletionsAndCollisions()
           
protected  void _ensureCapacity(int capacity)
           
protected  void _initializeDictionary()
           
 int _shallowHashCode()
           
 NSArray<K> allKeys()
           
 NSArray<K> allKeysForObject(Object object)
           
 NSArray<V> allValues()
           
 Class classForCoder()
           
 void clear()
           
 Object clone()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 int count()
           
static Object decodeObject(NSCoder coder)
           
static
<K,V> NSDictionary<K,V>
emptyDictionary()
           
 void encodeWithCoder(NSCoder coder)
           
 Set<Map.Entry<K,V>> entrySet()
           
 boolean equals(Object object)
           
 V get(Object key)
           
 int hashCode()
           
 HashMap<K,V> hashMap()
           
 Hashtable<K,V> hashtable()
           
 NSDictionary<K,V> immutableClone()
           
 boolean isEmpty()
           
 boolean isEqualToDictionary(NSDictionary<?,?> otherDictionary)
           
 Enumeration<K> keyEnumerator()
           
 Set<K> keySet()
           
protected  Object[] keysNoCopy()
           
 NSMutableDictionary<K,V> mutableClone()
           
 Enumeration<V> objectEnumerator()
           
 V objectForKey(Object key)
           
 NSArray<V> objectsForKeys(NSArray<? extends K> keys, V notFoundMarker)
           
protected  Object[] objectsNoCopy()
           
 V put(K key, V value)
           
 void putAll(Map<? extends K,? extends V> t)
           
 V remove(Object key)
           
 int size()
           
 void takeValueForKey(Object value, String key)
           
 void takeValueForKeyPath(Object value, String keyPath)
           
 String toString()
           
 Object valueForKey(String key)
           
 Object valueForKeyPath(String keyPath)
           
 Collection<V> values()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_CLASS

public static final Class _CLASS

_MAP_ENTRY_CLASS

public static final Class _MAP_ENTRY_CLASS

EmptyDictionary

public static final NSDictionary EmptyDictionary

_capacity

protected transient int _capacity

_hashtableBuckets

protected transient int _hashtableBuckets

_count

protected transient int _count

_objects

protected Object[] _objects

_objectsCache

protected transient Object[] _objectsCache

_flags

protected transient byte[] _flags

_keys

protected Object[] _keys

_keysCache

protected transient Object[] _keysCache

_hashCache

protected transient int _hashCache

_deletionLimit

protected transient int _deletionLimit

_NSDictionaryClassHashCode

protected static int _NSDictionaryClassHashCode

_NSDictionaryMapEntryHashCode

protected static int _NSDictionaryMapEntryHashCode

_keySetCache

protected Set<K> _keySetCache

_entrySetCache

protected Set<Map.Entry<K,V>> _entrySetCache

CheckForNull

public static final boolean CheckForNull
See Also:
Constant Field Values

IgnoreNull

public static final boolean IgnoreNull
See Also:
Constant Field Values
Constructor Detail

NSDictionary

public NSDictionary()

NSDictionary

public NSDictionary(V object,
                    K key)

NSDictionary

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

NSDictionary

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

NSDictionary

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

NSDictionary

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

NSDictionary

public NSDictionary(Map<? extends K,? extends V> map,
                    boolean ignoreNull)

NSDictionary

public NSDictionary(Dictionary<? extends K,? extends V> dictionary,
                    boolean ignoreNull)
Method Detail

_initializeDictionary

protected void _initializeDictionary()

_ensureCapacity

protected void _ensureCapacity(int capacity)

_clearDeletionsAndCollisions

protected void _clearDeletionsAndCollisions()

keysNoCopy

protected Object[] keysNoCopy()

objectsNoCopy

protected Object[] objectsNoCopy()

count

public int count()

objectForKey

public V objectForKey(Object key)

hashtable

public Hashtable<K,V> hashtable()

hashMap

public HashMap<K,V> hashMap()

allKeysForObject

public NSArray<K> allKeysForObject(Object object)

objectsForKeys

public NSArray<V> objectsForKeys(NSArray<? extends K> keys,
                                 V notFoundMarker)

isEqualToDictionary

public boolean isEqualToDictionary(NSDictionary<?,?> otherDictionary)

equals

public boolean equals(Object object)
Specified by:
equals in interface Map<K,V>
Overrides:
equals in class Object

allKeys

public NSArray<K> allKeys()

allValues

public NSArray<V> allValues()

keyEnumerator

public Enumeration<K> keyEnumerator()

objectEnumerator

public Enumeration<V> objectEnumerator()

valueForKey

public Object valueForKey(String key)
Specified by:
valueForKey in interface NSKeyValueCoding

takeValueForKey

public void takeValueForKey(Object value,
                            String key)
Specified by:
takeValueForKey in interface NSKeyValueCoding

valueForKeyPath

public Object valueForKeyPath(String keyPath)
Specified by:
valueForKeyPath in interface NSKeyValueCodingAdditions

takeValueForKeyPath

public void takeValueForKeyPath(Object value,
                                String keyPath)
Specified by:
takeValueForKeyPath in interface NSKeyValueCodingAdditions

classForCoder

public Class classForCoder()
Specified by:
classForCoder in interface NSCoding

emptyDictionary

public static final <K,V> NSDictionary<K,V> emptyDictionary()

decodeObject

public static Object decodeObject(NSCoder coder)

encodeWithCoder

public void encodeWithCoder(NSCoder coder)
Specified by:
encodeWithCoder in interface NSCoding

_shallowHashCode

public int _shallowHashCode()
Specified by:
_shallowHashCode in interface _NSFoundationCollection

hashCode

public int hashCode()
Specified by:
hashCode in interface Map<K,V>
Overrides:
hashCode in class Object

clone

public Object clone()
Overrides:
clone in class Object

immutableClone

public NSDictionary<K,V> immutableClone()

mutableClone

public NSMutableDictionary<K,V> mutableClone()

toString

public String toString()
Overrides:
toString in class Object

size

public int size()
Specified by:
size in interface Map<K,V>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Map<K,V>

containsKey

public boolean containsKey(Object key)
Specified by:
containsKey in interface Map<K,V>

containsValue

public boolean containsValue(Object value)
Specified by:
containsValue in interface Map<K,V>

get

public V get(Object key)
Specified by:
get in interface Map<K,V>

put

public V put(K key,
             V value)
Specified by:
put in interface Map<K,V>

remove

public V remove(Object key)
Specified by:
remove in interface Map<K,V>

putAll

public void putAll(Map<? extends K,? extends V> t)
Specified by:
putAll in interface Map<K,V>

clear

public void clear()
Specified by:
clear in interface Map<K,V>

keySet

public Set<K> keySet()
Specified by:
keySet in interface Map<K,V>

values

public Collection<V> values()
Specified by:
values in interface Map<K,V>

entrySet

public Set<Map.Entry<K,V>> entrySet()
Specified by:
entrySet in interface Map<K,V>

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

Copyright © 2002 – 2011 Project Wonder.