public final class NSArray extends NSCollection
List| Constructor and Description |
|---|
NSArray(java.util.Collection<? extends NSObject> theList)
Constructor.
|
NSArray(NSObject[] theList)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
NSObject[] |
array()
Get an array containing all values of this object.
|
static NSArray |
fromList(java.util.List<?> list)
Convert a list to an NSArray.
|
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 unmodifiable
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. |
java.util.List<java.lang.Object> |
toObject()
Converts this NSObject to a normal Java object.
|
toBytesequals, fromObject, hashCode, toBoolean, toDate, toInteger, toListObject, toMapObject, toNumber, toStream, toStringpublic NSArray(java.util.Collection<? extends NSObject> theList)
theList - the contents of new objectpublic NSArray(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 cannot be modified,
but can be used to instantiate a new ArrayList
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 NSObjectListgetValue()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<java.lang.Object> 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> 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.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 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.public double toDouble()
NSReal
the double value is derived from the actual value.public static NSArray fromList(java.util.List<?> list)
NSObject.getValue() always returns a valid object.