Package org.robovm.apple.foundation
Class NSArray<T extends NSObject>
java.lang.Object
org.robovm.rt.bro.NativeObject
org.robovm.objc.ObjCObject
org.robovm.apple.foundation.NSObject
org.robovm.apple.foundation.NSArray<T>
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>,NSFastEnumeration,NSObjectProtocol,NSPropertyList,ObjCProtocol
- Direct Known Subclasses:
NSMutableArray
public class NSArray<T extends NSObject> extends NSObject implements NSFastEnumeration, NSPropertyList, List<T>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNSArray.AsDoubleListMarshalerstatic classNSArray.AsIntegerListMarshalerstatic classNSArray.AsListMarshalerstatic classNSArray.AsStringListMarshalerstatic classNSArray.NSArrayPtr<T extends NSObject>Nested classes/interfaces inherited from class org.robovm.apple.foundation.NSObject
NSObject.Handle, NSObject.Marshaler, NSObject.NoRetainMarshaler, NSObject.NSKeyValueObserver, NSObject.NSObjectPtr, NSObject.SkipInitNested classes/interfaces inherited from class org.robovm.objc.ObjCObject
ObjCObject.ObjCObjectPtr, ObjCObject.Super -
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description NSArray()NSArray(Collection<T> c)protectedNSArray(NSObject.Handle h, long handle)protectedNSArray(NSObject.SkipInit skipInit)NSArray(T... objects) -
Method Summary
Modifier and Type Method Description booleanadd(boolean value)voidadd(int index, boolean value)voidadd(int index, Number value)voidadd(int index, String value)voidadd(int index, T element)booleanadd(Number value)booleanadd(String value)booleanadd(T e)booleanaddAll(int index, Collection<? extends T> c)booleanaddAll(Collection<? extends T> c)voidaddObserver(NSObject observer, NSIndexSet indexes, String keyPath, NSKeyValueObservingOptions options, VoidPtr context)protected voidafterMarshaled(int flags)List<String>asStringList()Use this method to convert a NSArray of NSString items to a List of String items.protected static voidcheckNull(Object o)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)protected booleancontainsObject(T anObject)protected AbstractList<T>createAdapter()Tfirst()static NSArray<NSNumber>fromNumbers(Number... numbers)static NSArray<NSNumber>fromNumbers(Collection<Number> numbers)static NSArray<NSString>fromStrings(String... strings)static NSArray<NSString>fromStrings(Collection<String> strings)Tget(int index)booleangetBoolean(int index)bytegetByte(int index)shortgetByte(short index)protected longgetCount()doublegetDouble(int index)floatgetFloat(int index)intgetInt(int index)longgetLong(int index)protected TgetObjectAt(long index)NSDatagetSortedArrayHint()StringgetString(int index)protected NSArray<T>getSubarray(NSRange range)intindexOf(boolean element)intindexOf(Number element)intindexOf(Object o)intindexOf(String element)protected longindexOfObject(T anObject)protected longinit(long objects, long cnt)protected longinit(NSArray<T> array)booleanisEmpty()Iterator<T>iterator()Tlast()intlastIndexOf(Object o)ListIterator<T>listIterator()ListIterator<T>listIterator(int index)static NSArray<?>read(File file)static NSArray<?>read(NSURL url)Deprecated.Use arrayWithContentsOfURL:error:protected static NSArray<?>readFile(String path)Deprecated.Use arrayWithContentsOfURL:error:booleanremove(boolean element)Tremove(int index)booleanremove(Number element)booleanremove(Object o)booleanremove(String element)booleanremoveAll(Collection<?> c)voidremoveObserver(NSObject observer, NSIndexSet indexes, String keyPath, VoidPtr context)booleanretainAll(Collection<?> c)Objectset(int index, boolean element)Objectset(int index, Number element)Objectset(int index, String element)Tset(int index, T element)intsize()NSArray<T>subList(int start, int end)Object[]toArray()<U> U[]toArray(U[] a)voidwrite(File file, boolean atomically)booleanwrite(NSURL url, boolean atomically)Deprecated.Use writeToURL:error:protected booleanwriteFile(String path, boolean atomically)Deprecated.Use writeToURL:error:Methods inherited from class org.robovm.apple.foundation.NSObject
addKeyValueObserver, addKeyValueObserver, alloc, autorelease, autorelease, awakeFromNib, conformsToProtocol, copy, description, didChangeValue, didChangeValue, didChangeValues, doDispose, equals, forceSkipInit, getAutoContentAccessingProxy, getClassForCoder, getClassForKeyedArchiver, getKeyValueCoder, getObservationInfo, hash, hashCode, init, isEqual, isKindOfClass, isMemberOfClass, mutableCopy, performSelector, performSelector, performSelector, performSelector, performSelector, performSelector, performSelector, performSelectorInBackground, performSelectorOnMainThread, performSelectorOnMainThread, performSelectorV, performSelectorV, performSelectorV, release, release, removeKeyValueObserver, removeKeyValueObservers, respondsToSelector, retain, retain, retainCount, setObservationInfo, toString, willChangeValue, willChangeValue, willChangeValuesMethods inherited from class org.robovm.objc.ObjCObject
addStrongRef, dispose, dispose, finalize, getAssociatedObject, getObjCClass, getPeerObject, getSuper, initObject, logRetainRelease, removeStrongRef, retainCustomObjectFromCb, setAssociatedObject, toObjCObject, toObjCObject, updateStrongRef
-
Constructor Details
-
Method Details
-
getCount
protected long getCount() -
first
-
last
-
getSortedArrayHint
-
checkNull
-
createAdapter
-
afterMarshaled
protected void afterMarshaled(int flags)- Overrides:
afterMarshaledin classNSObject
-
add
-
add
-
addAll
-
addAll
-
clear
public void clear() -
contains
-
containsAll
- Specified by:
containsAllin interfaceCollection<T extends NSObject>- Specified by:
containsAllin interfaceList<T extends NSObject>
-
get
-
indexOf
-
isEmpty
public boolean isEmpty() -
iterator
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<T extends NSObject>
-
listIterator
- Specified by:
listIteratorin interfaceList<T extends NSObject>
-
listIterator
- Specified by:
listIteratorin interfaceList<T extends NSObject>
-
remove
-
remove
-
removeAll
-
retainAll
-
set
-
size
public int size() -
subList
-
toArray
-
toArray
public <U> U[] toArray(U[] a) -
getBoolean
public boolean getBoolean(int index) -
getByte
public byte getByte(int index) -
getByte
public short getByte(short index) -
getInt
public int getInt(int index) -
getLong
public long getLong(int index) -
getFloat
public float getFloat(int index) -
getDouble
public double getDouble(int index) -
getString
-
add
public boolean add(boolean value) -
add
public void add(int index, boolean value) -
add
-
add
-
add
-
add
-
set
-
set
-
set
-
indexOf
public int indexOf(boolean element) -
indexOf
-
indexOf
-
remove
public boolean remove(boolean element) -
remove
-
remove
-
read
-
write
-
asStringList
Use this method to convert a NSArray of NSString items to a List of String items. Elements of this NSArray must be of type NSString, otherwise an exception will be thrown.- Returns:
- Throws:
UnsupportedOperationException- when the array items are not of type NSString.
-
fromStrings
-
fromStrings
-
fromNumbers
-
fromNumbers
-
getObjectAt
-
init
protected long init(long objects, long cnt) -
containsObject
-
indexOfObject
-
getSubarray
-
init
-
writeFile
Deprecated.Use writeToURL:error: -
write
Deprecated.Use writeToURL:error: -
readFile
Deprecated.Use arrayWithContentsOfURL:error: -
read
Deprecated.Use arrayWithContentsOfURL:error: -
addObserver
public void addObserver(NSObject observer, NSIndexSet indexes, String keyPath, NSKeyValueObservingOptions options, VoidPtr context) -
removeObserver
-