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,NSObject> theMap)
Alternative constructor.
|
NSDictionary(java.util.SortedMap<java.lang.String,NSObject> theMap)
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 . |
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. |
public NSDictionary(java.util.SortedMap<java.lang.String,NSObject> theMap)
SortedMap
in order to keep the ordering.theMap
- value of the new objectpublic NSDictionary(java.util.Map<java.lang.String,NSObject> theMap)
TreeMap
will be constructed in order to achieve this.theMap
- value of the new objectpublic NSObject get(java.lang.String key)
NSObject
associated with key
.key
- The key to retrieveNSObject
associated with key
Map.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 NSObject
SortedMap
getValue()
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.TRUE
NSString
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 elementsNSDate
NSData
with a length greater than 0public long toLong()
NSInteger
the long value is derived from the actual value.