public final class NSArray extends NSCollection
List
Constructor and Description |
---|
NSArray(java.util.List<NSObject> theList)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
NSObject[] |
array()
Get an array containing all values of this object.
|
NSObject |
get(int index)
Get
NSObject corresponding to index from this object. |
java.util.List<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()
Get an unlinked modifiable
List containing all values of this object. |
long |
toLong()
Return the value as a long.
|
java.util.SortedMap<java.lang.String,NSObject> |
toMap()
Try to retrieve the
SortedMap contained in this NSObject . |
public NSArray(java.util.List<NSObject> theList)
theList
- the contents of new objectpublic NSObject get(int index)
NSObject
corresponding to index from this object.index
- index of object to retrievepublic java.util.List<NSObject> toList()
List
containing all values of this object.
This List
can be modified and then used to create a new NSArray
.
Each subsequent call to toList()
will create a new ArrayList
.
Use getValue()
to get an unmodifiable List
.toList
in class NSObject
List
getValue()
public NSObject[] array()
Get an array containing all values of this object. Changes made in the array will not affect this object.
When iterating through all items in this object,
the toList()
method is a better choice for performance reasons.
public java.util.List<NSObject> getValue()
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 java.util.SortedMap<java.lang.String,NSObject> toMap()
SortedMap
contained in this NSObject
.
This method will return the SortedMap
if the object is a NSDictionary
and will return a SortedMap
containing incremental keys and all the values
if this object is a NSArray
. Otherwise an empty list is returned.public long toLong()
NSInteger
the long value is derived from the actual value.