public final class NSDictionary extends NSCollection
A key/value store,
with String as keys and NSObject as values.
Usually, the root node of a Property List is a NSDictionary.
In this implementation, a SortedMap is used
to represent the NSDictionary.
SortedMap| Constructor and Description |
|---|
NSDictionary(java.util.Map<java.lang.String,? extends NSObject> map)
Standard constructor.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.Set<java.util.Map.Entry<java.lang.String,NSObject>> |
entrySet()
Get the entryset for this
NSObject. |
static NSDictionary |
fromMap(java.util.Map<java.lang.String,?> map)
Convert a map to a NSDictionary.
|
NSObject |
get(java.lang.String key)
Get the
NSObject associated with key. |
java.util.SortedMap<java.lang.String,NSObject> |
getValue()
Get the unmodifiable value of this object.
|
boolean |
isTrue()
Return whether or not the value evaluates to true.
|
double |
toDouble()
Return the value as a double.
|
java.util.List<NSObject> |
toList()
Try to retrieve the list contained in this
NSObject. |
long |
toLong()
Return the value as a long.
|
java.util.SortedMap<java.lang.String,NSObject> |
toMap()
Get an unlinked modifiable
SortedMap
containing all values of this object. |
java.util.SortedMap<java.lang.String,?> |
toObject()
Converts this NSObject to a normal Java object.
|
toBytesequals, fromObject, hashCode, toBoolean, toDate, toInteger, toListObject, toMapObject, toNumber, toStream, toStringpublic NSDictionary(java.util.Map<java.lang.String,? extends NSObject> map)
SortedMap
in order to keep the ordering.map - value of the new objectpublic static NSDictionary fromMap(java.util.Map<java.lang.String,?> map)
NSObject.getValue() always returns a valid object.public NSObject get(java.lang.String key)
NSObject associated with key.key - The key to retrieveNSObject associated with keyMap.get(Object)public java.util.Set<java.util.Map.Entry<java.lang.String,NSObject>> entrySet()
NSObject.Map.entrySet()public java.util.SortedMap<java.lang.String,NSObject> getValue()
public java.util.SortedMap<java.lang.String,NSObject> toMap()
SortedMap
containing all values of this object.
This SortedMap can be modified and then
used to create a new NSDictionary.
Each subsequent call to toMap()
will create a new SortedMap.
Use getValue() to get an unmodifiable SortedMap.toMap in class NSObjectSortedMapgetValue()public java.util.SortedMap<java.lang.String,?> toObject()
NSObject.fromObject(Object) which will convert the object back to an NSObject.
Note: This method will NOT convert NSUID objects,
because there is no Java equivalent for those.public java.util.List<NSObject> toList()
NSObject.
This method will return the list if the object is a NSArray
and will return a list containing all the values (but without the keys)
if this object is a NSDictionary. Otherwise an empty list is returned.public boolean isTrue()
Return whether or not the value evaluates to true.
A value returns to true if and only if
NSBoolean type NSBoolean.TRUENSString which has a length greater than zero and does not equal "NO" or "False" (case insensitive)NSNumber greater than 0NSCollection which contains more than zero elementsNSDateNSData with a length greater than 0public long toLong()
NSInteger
the long value is derived from the actual value.