public class NSArray extends NSObject
| Constructor and Description |
|---|
NSArray(int length)
Creates a new NSArray instance of the specified size.
|
NSArray(NSObject... a)
Creates a new NSArray instance containing the specified elements.
|
| Modifier and Type | Method and Description |
|---|---|
NSArray |
clone()
Creates and returns a deep copy of this instance.
|
int |
compareTo(NSObject o) |
boolean |
containsObject(Object obj)
Checks whether an object is present in the array or whether it is equal
to any of the objects in the array.
|
int |
count()
Returns the size of the array.
|
boolean |
equals(Object obj) |
NSObject[] |
getArray()
Returns the array of NSObjects represented by this NSArray.
|
int |
hashCode() |
int |
indexOfIdenticalObject(Object obj)
Searches for a specific object in the array.
|
int |
indexOfObject(Object obj)
Searches for an object in the array.
|
NSObject |
lastObject()
Returns the last object contained in this array.
|
NSObject |
objectAtIndex(int i)
Returns the object stored at the given index.
|
NSObject[] |
objectsAtIndexes(int... indexes)
Returns a new array containing only the values stored at the given
indices.
|
void |
remove(int i)
Removes the i-th element from the array.
|
void |
setValue(int key,
Object value)
Stores an object at the specified index.
|
protected void |
toASCII(StringBuilder ascii,
int level)
Generates the ASCII representation of this object.
|
protected void |
toASCIIGnuStep(StringBuilder ascii,
int level)
Generates the ASCII representation of this object in the GnuStep format.
|
String |
toASCIIPropertyList()
Generates a valid ASCII property list which has this NSArray as its
root object.
|
String |
toGnuStepASCIIPropertyList()
Generates a valid ASCII property list in GnuStep format which has this
NSArray as its root object.
|
Object |
toJavaObject()
Converts this NSObject into an equivalent object of the Java Runtime Environment.
|
fromJavaObject, getLocationInformation, indent, toJavaObject, toXMLPropertyListpublic NSArray(int length)
length - The number of elements the NSArray instance will be able to hold.public NSArray(NSObject... a)
a - The elements to be contained by the NSArray instance.public NSObject objectAtIndex(int i)
getArray()[i].i - The index of the object.public void remove(int i)
i - The index of the objectpublic void setValue(int key,
Object value)
getArray()[key] = value.key - The index where to store the object.value - The object.public NSObject[] getArray()
public int count()
public boolean containsObject(Object obj)
obj - The object to look for.true, when the object could be found. false otherwise.Object.equals(java.lang.Object)public int indexOfObject(Object obj)
obj - The object to look for.Object.equals(java.lang.Object),
indexOfIdenticalObject(Object)public int indexOfIdenticalObject(Object obj)
obj - The object to look for.indexOfObject(Object)public NSObject lastObject()
getArray()[getArray().length-1].public NSObject[] objectsAtIndexes(int... indexes)
indexes - The indices of the objects.public NSArray clone()
NSObjectpublic Object toJavaObject()
NSObjectNSArray objects are converted to arrays.NSDictionary objects are converted to objects extending the Map class.NSSet objects are converted to objects extending the Set class.NSNumber objects are converted to primitive number values (int, long, double or boolean).NSString objects are converted to String objects.NSData objects are converted to byte arrays.NSDate objects are converted to Date objects.UID objects are converted to byte arrays.toJavaObject in class NSObjectpublic int compareTo(NSObject o)
public String toASCIIPropertyList()
public String toGnuStepASCIIPropertyList()
protected void toASCII(StringBuilder ascii, int level)
NSObjectascii - The StringBuilder onto which the ASCII representation is appended.level - The indentation level of the object.protected void toASCIIGnuStep(StringBuilder ascii, int level)
NSObjectascii - The StringBuilder onto which the ASCII representation is appended.level - The indentation level of the object.Copyright © 2024. All rights reserved.