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:
java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.List<T>
,NSFastEnumeration
,NSObjectProtocol
,NSPropertyList
,org.robovm.objc.ObjCProtocol
- Direct Known Subclasses:
NSMutableArray
public class NSArray<T extends NSObject> extends NSObject implements NSFastEnumeration, NSPropertyList, java.util.List<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NSArray.AsDoubleListMarshaler
static class
NSArray.AsIntegerListMarshaler
static class
NSArray.AsListMarshaler
static class
NSArray.AsStringListMarshaler
static class
NSArray.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.SkipInit
-
-
Field Summary
-
Fields inherited from class org.robovm.apple.foundation.NSObject
FLAG_NO_RETAIN
-
-
Constructor Summary
Constructors Modifier Constructor Description NSArray()
NSArray(java.util.Collection<T> c)
protected
NSArray(NSObject.Handle h, long handle)
protected
NSArray(NSObject.SkipInit skipInit)
NSArray(T... objects)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(boolean value)
void
add(int index, boolean value)
void
add(int index, java.lang.Number value)
void
add(int index, java.lang.String value)
void
add(int index, T element)
boolean
add(java.lang.Number value)
boolean
add(java.lang.String value)
boolean
add(T e)
boolean
addAll(int index, java.util.Collection<? extends T> c)
boolean
addAll(java.util.Collection<? extends T> c)
void
addObserver(NSObject observer, NSIndexSet indexes, java.lang.String keyPath, NSKeyValueObservingOptions options, org.robovm.rt.bro.ptr.VoidPtr context)
protected void
afterMarshaled(int flags)
java.util.List<java.lang.String>
asStringList()
Use this method to convert a NSArray of NSString items to a List of String items.protected static void
checkNull(java.lang.Object o)
void
clear()
boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
protected boolean
containsObject(NSObject anObject)
protected java.util.AbstractList<T>
createAdapter()
T
first()
static NSArray<NSNumber>
fromNumbers(java.lang.Number... numbers)
static NSArray<NSNumber>
fromNumbers(java.util.Collection<java.lang.Number> numbers)
static NSArray<NSString>
fromStrings(java.lang.String... strings)
static NSArray<NSString>
fromStrings(java.util.Collection<java.lang.String> strings)
T
get(int index)
boolean
getBoolean(int index)
byte
getByte(int index)
short
getByte(short index)
protected long
getCount()
double
getDouble(int index)
float
getFloat(int index)
int
getInt(int index)
long
getLong(int index)
protected T
getObjectAt(long index)
NSData
getSortedArrayHint()
java.lang.String
getString(int index)
protected NSArray<T>
getSubarray(NSRange range)
int
indexOf(boolean element)
int
indexOf(java.lang.Number element)
int
indexOf(java.lang.Object o)
int
indexOf(java.lang.String element)
protected long
indexOfObject(NSObject anObject)
protected long
init(long objects, long cnt)
protected long
init(NSArray<?> array)
boolean
isEmpty()
java.util.Iterator<T>
iterator()
T
last()
int
lastIndexOf(java.lang.Object o)
java.util.ListIterator<T>
listIterator()
java.util.ListIterator<T>
listIterator(int index)
static NSArray<?>
read(java.io.File file)
static NSArray<?>
read(NSURL url)
protected static NSArray<?>
readFile(java.lang.String path)
boolean
remove(boolean element)
T
remove(int index)
boolean
remove(java.lang.Number element)
boolean
remove(java.lang.Object o)
boolean
remove(java.lang.String element)
boolean
removeAll(java.util.Collection<?> c)
void
removeObserver(NSObject observer, NSIndexSet indexes, java.lang.String keyPath, org.robovm.rt.bro.ptr.VoidPtr context)
boolean
retainAll(java.util.Collection<?> c)
java.lang.Object
set(int index, boolean element)
java.lang.Object
set(int index, java.lang.Number element)
java.lang.Object
set(int index, java.lang.String element)
T
set(int index, T element)
int
size()
NSArray<T>
subList(int start, int end)
java.lang.Object[]
toArray()
<U> U[]
toArray(U[] a)
void
write(java.io.File file, boolean atomically)
boolean
write(NSURL url, boolean atomically)
protected boolean
writeFile(java.lang.String path, boolean atomically)
-
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, willChangeValues
-
-
-
-
Constructor Detail
-
NSArray
public NSArray()
-
NSArray
protected NSArray(NSObject.Handle h, long handle)
-
NSArray
protected NSArray(NSObject.SkipInit skipInit)
-
NSArray
public NSArray(java.util.Collection<T> c)
-
NSArray
public NSArray(T... objects)
-
-
Method Detail
-
getCount
protected long getCount()
-
first
public T first()
- Since:
- Available in iOS 4.0 and later.
-
last
public T last()
-
getSortedArrayHint
public NSData getSortedArrayHint()
-
checkNull
protected static void checkNull(java.lang.Object o)
-
createAdapter
protected java.util.AbstractList<T> createAdapter()
-
afterMarshaled
protected void afterMarshaled(int flags)
- Overrides:
afterMarshaled
in classNSObject
-
add
public void add(int index, T element)
-
add
public boolean add(T e)
-
addAll
public boolean addAll(java.util.Collection<? extends T> c)
-
addAll
public boolean addAll(int index, java.util.Collection<? extends T> c)
-
clear
public void clear()
-
contains
public boolean contains(java.lang.Object o)
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
indexOf
public int indexOf(java.lang.Object o)
-
isEmpty
public boolean isEmpty()
-
iterator
public java.util.Iterator<T> iterator()
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
-
listIterator
public java.util.ListIterator<T> listIterator()
-
listIterator
public java.util.ListIterator<T> listIterator(int index)
-
remove
public T remove(int index)
-
remove
public boolean remove(java.lang.Object o)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
size
public int size()
-
toArray
public java.lang.Object[] 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
public java.lang.String getString(int index)
-
add
public boolean add(boolean value)
-
add
public void add(int index, boolean value)
-
add
public boolean add(java.lang.Number value)
-
add
public void add(int index, java.lang.Number value)
-
add
public boolean add(java.lang.String value)
-
add
public void add(int index, java.lang.String value)
-
set
public java.lang.Object set(int index, boolean element)
-
set
public java.lang.Object set(int index, java.lang.Number element)
-
set
public java.lang.Object set(int index, java.lang.String element)
-
indexOf
public int indexOf(boolean element)
-
indexOf
public int indexOf(java.lang.Number element)
-
indexOf
public int indexOf(java.lang.String element)
-
remove
public boolean remove(boolean element)
-
remove
public boolean remove(java.lang.Number element)
-
remove
public boolean remove(java.lang.String element)
-
read
public static NSArray<?> read(java.io.File file)
-
write
public void write(java.io.File file, boolean atomically)
-
asStringList
public java.util.List<java.lang.String> 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:
java.lang.UnsupportedOperationException
- when the array items are not of type NSString.
-
fromStrings
public static NSArray<NSString> fromStrings(java.util.Collection<java.lang.String> strings)
-
fromNumbers
public static NSArray<NSNumber> fromNumbers(java.util.Collection<java.lang.Number> numbers)
-
getObjectAt
protected T getObjectAt(long index)
-
init
protected long init(long objects, long cnt)
-
containsObject
protected boolean containsObject(NSObject anObject)
-
indexOfObject
protected long indexOfObject(NSObject anObject)
-
init
protected long init(NSArray<?> array)
-
writeFile
protected boolean writeFile(java.lang.String path, boolean atomically)
-
write
public boolean write(NSURL url, boolean atomically)
-
readFile
protected static NSArray<?> readFile(java.lang.String path)
-
addObserver
public void addObserver(NSObject observer, NSIndexSet indexes, java.lang.String keyPath, NSKeyValueObservingOptions options, org.robovm.rt.bro.ptr.VoidPtr context)
-
removeObserver
public void removeObserver(NSObject observer, NSIndexSet indexes, java.lang.String keyPath, org.robovm.rt.bro.ptr.VoidPtr context)
- Since:
- Available in iOS 5.0 and later.
-
-