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.
|
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.
|
fromJavaObject, toJavaObject, toJavaObject, toXMLPropertyList
public 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()
NSObject
public String toASCIIPropertyList()
public String toGnuStepASCIIPropertyList()
protected void toASCII(StringBuilder ascii, int level)
NSObject
toASCII
in class NSObject
ascii
- The StringBuilder
onto which the ASCII representation is appended.level
- The indentation level of the object.protected void toASCIIGnuStep(StringBuilder ascii, int level)
NSObject
toASCIIGnuStep
in class NSObject
ascii
- The StringBuilder
onto which the ASCII representation is appended.level
- The indentation level of the object.Copyright © 2019. All rights reserved.