|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.wotonomy.foundation.NSArray
public class NSArray
NSArray is an unmodifiable List. Calling the mutator methods of the List interface (add, addAll, set, etc.) on an instance of NSArray will throw an Unsupported Operation exception: use a NSMutableArray instead. This is to simulate Objective-C's pattern of exposing mutator methods only on mutable subinterface, which is wonderful for communicating via interface the contract on returned collections (whether you may modify return values) as well as implementing array faults.
| Field Summary | |
|---|---|
static NSArray |
EmptyArray
A constant representing an empty array. |
static int |
NotFound
Return value when array index is not found. |
| Constructor Summary | |
|---|---|
NSArray()
Default constructor returns an empty array. |
|
NSArray(java.util.Collection aCollection)
Produces an array containing the objects in the specified collection. |
|
NSArray(java.lang.Object anObject)
Produces an array containing only the specified object. |
|
NSArray(java.lang.Object[] anArray)
Produces an array containing the specified objects. |
|
| Method Summary | |
|---|---|
void |
add(int index,
java.lang.Object element)
|
boolean |
add(java.lang.Object o)
|
boolean |
addAll(java.util.Collection coll)
|
boolean |
addAll(int index,
java.util.Collection c)
|
static NSArray |
arrayBackedByList(java.util.List aList)
Returns an NSArray backed by the specified List. |
NSArray |
arrayByAddingObject(java.lang.Object anObject)
Returns an array containing all objects in this array plus the specified object. |
NSArray |
arrayByAddingObjectsFromArray(java.util.Collection aCollection)
Returns an array containing all objects in this array plus all objects in the specified list. |
void |
clear()
|
java.lang.Object |
clone()
|
java.lang.String |
componentsJoinedByString(java.lang.String separator)
Returns a string containing the string representations of each element in this array, with each element separated from each neighboring element by the specified string. |
static NSArray |
componentsSeparatedByString(java.lang.String aString,
java.lang.String aSeparator)
Returns an array consisting of strings within the specified string as delimited by the specified separator characters. |
boolean |
contains(java.lang.Object o)
|
boolean |
containsAll(java.util.Collection c)
|
boolean |
containsObject(java.lang.Object anObject)
Returns whether an equivalent object is contained in this array. |
int |
count()
Returns the number of items in this array. |
boolean |
equals(java.lang.Object o)
|
java.lang.Object |
firstObjectCommonWithArray(java.util.Collection aCollection)
Returns the first object in this array that is equivalent to an object in the specified list, or null if no objects are in common. |
java.lang.Object |
get(int index)
|
void |
getObjects(java.lang.Object[] anArray)
Copies the elements of this array into the specified object array as the array's capacity permits. |
void |
getObjects(java.lang.Object[] array,
NSRange range)
Copies the elements of this array that fall within the specified range into the specified object array as the array's capacity permits. |
int |
hashCode()
|
NSArray |
immutableClone()
|
int |
indexOf(java.lang.Object o)
|
int |
indexOfIdenticalObject(java.lang.Object anObject)
Returns the index of the specified object if it exists in the array, comparing by reference. |
int |
indexOfIdenticalObject(java.lang.Object anObject,
NSRange aRange)
Returns the index of the first object in the array within the specified range equivalent to the specified object. |
int |
indexOfObject(java.lang.Object anObject)
Returns the index of the first object in the array equivalent to the specified object. |
int |
indexOfObject(java.lang.Object anObject,
NSRange aRange)
Returns the index of the first object in the array within the specified range equivalent to the specified object. |
boolean |
isEmpty()
|
boolean |
isEqualToArray(java.util.List aList)
Returns whether the specified list contains elements equivalent to those in this array in the same order. |
java.util.Iterator |
iterator()
|
int |
lastIndexOf(java.lang.Object o)
|
java.lang.Object |
lastObject()
Returns the last object in this array, or null if the array is empty. |
java.util.ListIterator |
listIterator()
|
java.util.ListIterator |
listIterator(int index)
|
NSMutableArray |
mutableClone()
|
java.lang.Object |
objectAtIndex(int anIndex)
Returns the object at the specified index. |
java.util.Enumeration |
objectEnumerator()
Returns an enumeration over the the elements of the array. |
protected boolean |
protectedAdd(java.lang.Object o)
Provided for the use of subclasses like ArrayFault. |
protected boolean |
protectedAddAll(java.util.Collection coll)
Provided for the use of subclasses like ArrayFault. |
java.lang.Object |
remove(int index)
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection coll)
|
boolean |
retainAll(java.util.Collection coll)
|
java.util.Enumeration |
reverseObjectEnumerator()
Returns an enumeration over the elements of the array in reverse order. |
java.lang.Object |
set(int index,
java.lang.Object element)
|
int |
size()
|
NSArray |
subarrayWithRange(NSRange aRange)
Returns an array comprised of only those elements whose indices fall within the specified range. |
java.util.List |
subList(int fromIndex,
int toIndex)
|
java.lang.Object[] |
toArray()
|
java.lang.Object[] |
toArray(java.lang.Object[] a)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int NotFound
public static final NSArray EmptyArray
| Constructor Detail |
|---|
public NSArray()
public NSArray(java.lang.Object anObject)
public NSArray(java.lang.Object[] anArray)
public NSArray(java.util.Collection aCollection)
| Method Detail |
|---|
public static NSArray arrayBackedByList(java.util.List aList)
public int count()
public NSArray arrayByAddingObject(java.lang.Object anObject)
public NSArray arrayByAddingObjectsFromArray(java.util.Collection aCollection)
public java.lang.String componentsJoinedByString(java.lang.String separator)
public boolean containsObject(java.lang.Object anObject)
public java.lang.Object firstObjectCommonWithArray(java.util.Collection aCollection)
public boolean isEqualToArray(java.util.List aList)
public java.lang.Object lastObject()
public NSArray subarrayWithRange(NSRange aRange)
public java.util.Enumeration objectEnumerator()
public java.util.Enumeration reverseObjectEnumerator()
public void getObjects(java.lang.Object[] anArray)
public void getObjects(java.lang.Object[] array,
NSRange range)
anArray - An object array to be filled by this method.range - An NSRange object representing the range of data in the NSArray to be copied.public int indexOfObject(java.lang.Object anObject)
public int indexOfObject(java.lang.Object anObject,
NSRange aRange)
public int indexOfIdenticalObject(java.lang.Object anObject)
public int indexOfIdenticalObject(java.lang.Object anObject,
NSRange aRange)
public java.lang.Object objectAtIndex(int anIndex)
public static NSArray componentsSeparatedByString(java.lang.String aString,
java.lang.String aSeparator)
public java.lang.Object clone()
clone in class java.lang.Objectpublic NSArray immutableClone()
public NSMutableArray mutableClone()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean contains(java.lang.Object o)
contains in interface java.util.Collectioncontains in interface java.util.Listpublic boolean containsAll(java.util.Collection c)
containsAll in interface java.util.CollectioncontainsAll in interface java.util.Listpublic boolean equals(java.lang.Object o)
equals in interface java.util.Collectionequals in interface java.util.Listequals in class java.lang.Objectpublic java.lang.Object get(int index)
get in interface java.util.Listpublic int hashCode()
hashCode in interface java.util.CollectionhashCode in interface java.util.ListhashCode in class java.lang.Objectpublic int indexOf(java.lang.Object o)
indexOf in interface java.util.Listpublic boolean isEmpty()
isEmpty in interface java.util.CollectionisEmpty in interface java.util.Listpublic int lastIndexOf(java.lang.Object o)
lastIndexOf in interface java.util.Listpublic int size()
size in interface java.util.Collectionsize in interface java.util.Listpublic java.lang.Object[] toArray()
toArray in interface java.util.CollectiontoArray in interface java.util.Listpublic java.lang.Object[] toArray(java.lang.Object[] a)
toArray in interface java.util.CollectiontoArray in interface java.util.List
public void add(int index,
java.lang.Object element)
add in interface java.util.Listpublic boolean add(java.lang.Object o)
add in interface java.util.Collectionadd in interface java.util.Listpublic boolean addAll(java.util.Collection coll)
addAll in interface java.util.CollectionaddAll in interface java.util.List
public boolean addAll(int index,
java.util.Collection c)
addAll in interface java.util.Listpublic void clear()
clear in interface java.util.Collectionclear in interface java.util.Listpublic java.util.Iterator iterator()
iterator in interface java.lang.Iterableiterator in interface java.util.Collectioniterator in interface java.util.Listpublic java.util.ListIterator listIterator()
listIterator in interface java.util.Listpublic java.util.ListIterator listIterator(int index)
listIterator in interface java.util.Listpublic java.lang.Object remove(int index)
remove in interface java.util.Listpublic boolean remove(java.lang.Object o)
remove in interface java.util.Collectionremove in interface java.util.Listpublic boolean removeAll(java.util.Collection coll)
removeAll in interface java.util.CollectionremoveAll in interface java.util.Listpublic boolean retainAll(java.util.Collection coll)
retainAll in interface java.util.CollectionretainAll in interface java.util.List
public java.lang.Object set(int index,
java.lang.Object element)
set in interface java.util.List
public java.util.List subList(int fromIndex,
int toIndex)
subList in interface java.util.Listprotected boolean protectedAdd(java.lang.Object o)
protected boolean protectedAddAll(java.util.Collection coll)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||