|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.extensions.foundation.ERXArrayUtilities
public class ERXArrayUtilities
Collection of NSArray
utilities.
Nested Class Summary | |
---|---|
static class |
ERXArrayUtilities.AvgNonNullOperator
Define an NSArray.Operator
for the key avgNonNull.This allows for key value paths like: myArray.valueForKey("@avgNonNull.payment.amount");
myArray.valueForKey("payment.@avgNonNull.amount");
myArray.valueForKey("payment.amount.@avgNonNull");
which will sum up all values for the key amount and divide by the number
of nun-null entries. |
static class |
ERXArrayUtilities.FetchSpecOperator
Define an NSArray.Operator
for the key fetchSpec.This allows for key value paths like: myArray.valueForKey("@fetchSpec.fetchUsers"); Which in this case would return myArray filtered and sorted by the EOFetchSpecification named "fetchUsers" which must be a model-based fetchspec in the first object's entity. |
static class |
ERXArrayUtilities.FlattenOperator
Define an NSArray.Operator
for the key flatten.This allows for key value paths like: myArray.valueForKey("@flatten.someOtherPath"); Which in this case would return myArray flattened if myArray is an NSArray of NSArrays (of NSArrays etc) before continuing to process someOtherPath. |
static class |
ERXArrayUtilities.IsEmptyOperator
Define an NSArray.Operator
for the key isEmpty.This allows for key value paths like: myArray.valueForKey("@isEmpty"); Which in this case would return true if the
myArray.count() == 0, or false if it is not. |
static class |
ERXArrayUtilities.LimitOperator
Define an NSArray.Operator
for the key limit, which is similar to subarrayWithRange except it is
always from 0 to the limit value. |
static class |
ERXArrayUtilities.MedianOperator
Define an NSArray.Operator
for the key median.This allows for key value paths like: myArray.valueForKey("@median.payment.amount");
myArray.valueForKey("payment.@median.amount");
myArray.valueForKey("payment.amount.@median");
which return the median of the array elements at the given key path. |
static class |
ERXArrayUtilities.ObjectAtIndexOperator
Define an NSArray.Operator for the key objectAtIndex.This allows for key value paths like: myArray.valueForKey("@objectAtIndex.3.firstName"); |
static class |
ERXArrayUtilities.RemoveNullValuesOperator
Define an NSArray.Operator
for the key removeNullValues.This allows for key value paths like: myArray.valueForKeyPath("@removeNullValues.someOtherPath"); Which in this case would remove the occurrences of NSKeyValueCoding.Null from myArray before continuing to process someOtherPath. |
static class |
ERXArrayUtilities.ReverseOperator
Define an NSArray.Operator
for the key reverse.This allows for key value paths like: myArray.valueForKey("@reverse.someOtherPath"); which would reverse the order of the array myArray before continuing to process someOtherPath. |
static class |
ERXArrayUtilities.SortOperator
Define an NSArray.Operator
for the key sort.This allows for key value paths like: myArray.valueForKey("@sort.firstName");
myArray.valueForKey("@sort.lastName,firstName.length");
Which in the first case would return myArray sorted ascending by first name
and the second case by lastName and then by the length() of the firstName. |
static class |
ERXArrayUtilities.StandardDeviationOperator
Define an NSArray.Operator
for the key stdDev and popStdDev.This allows for key value paths like: myArray.valueForKey("@stdDev.payment.amount");
myArray.valueForKey("payment.@stdDev.amount");
myArray.valueForKey("payment.amount.@stdDev");
All three of these examples will return the same value, which in this case
is the standard deviation of the amounts. |
static class |
ERXArrayUtilities.SubarrayWithRangeOperator
Define an NSArray.Operator
for the key subarrayWithRange.This allows for key value paths like: myArray.valueForKeyPath("@subarrayWithRange.20-3.someOtherPath"); Which in this case would return the three objects from myArray , starting
at the index of 20, before continuing to process someOtherPath . |
static class |
ERXArrayUtilities.UniqueOperator
Define an NSArray.Operator
for the key unique.This allows for key value paths like: myArray.valueForKeyPath("@unique.someOtherPath"); Which in this case would return only those objects which are unique in myArray before continuing to process someOtherPath. |
Field Summary | |
---|---|
static java.lang.String |
NULL_GROUPING_KEY
Holds the null grouping key for use when grouping objects based on a key that might return null and nulls are allowed |
Constructor Summary | |
---|---|
ERXArrayUtilities()
|
Method Summary | ||
---|---|---|
static
|
addObjectsFromArrayWithoutDuplicates(com.webobjects.foundation.NSMutableArray<T> a1,
com.webobjects.foundation.NSArray<? extends T> a2)
Adds all of the non-duplicate elements from the second array to the mutable array. |
|
static
|
arrayByAddingObjectsFromArrayWithoutDuplicates(com.webobjects.foundation.NSArray<? extends T> a1,
com.webobjects.foundation.NSArray<? extends T> a2)
Creates an array preserving order by adding all of the non-duplicate values from the second array to the first. |
|
static
|
arrayByRemovingFirstObject(com.webobjects.foundation.NSArray<T> array)
Creates an array that has all of the objects of the parameter array without the first object. |
|
static
|
arrayBySelectingInstancesOfClass(com.webobjects.foundation.NSArray<?> array,
java.lang.Class<T> aClass)
Prunes an array for only instances of the given class. |
|
static
|
arrayContainsAnyObjectFromArray(com.webobjects.foundation.NSArray<? extends T> array,
com.webobjects.foundation.NSArray<? extends T> objects)
Function to determine if an array contains any of the elements of another array. |
|
static
|
arrayContainsArray(com.webobjects.foundation.NSArray<? extends T> array,
com.webobjects.foundation.NSArray<? extends T> objects)
Function to determine if an array contains all of the elements of another array. |
|
static com.webobjects.foundation.NSArray<?> |
arrayForKeysPath(com.webobjects.foundation.NSArray<?> array,
com.webobjects.foundation.NSArray<java.lang.String> keys)
Returns an array of dictionaries containing the key/value pairs for the given paths. |
|
static com.webobjects.foundation.NSArray |
arrayFromPropertyList(java.lang.String name,
com.webobjects.foundation.NSBundle bundle)
Creates an NSArray from a resource associated with a given bundle that is in property list format. |
|
static
|
arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<T> objects,
ERXKey<K> keyPath,
boolean includeNulls,
ERXKey<V> valueKeyPath)
Starting with an array of KeyValueCoding-compliant objects and a keyPath, this method calls valueForKey on each object in the array and groups the contents of the array, using the result of the valueForKey call as a key in a dictionary. |
|
static
|
arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<T> objects,
ERXKey<K> keyPath,
K nullGroupingKey,
ERXKey<V> valueKeyPath)
Starting with an array of KeyValueCoding-compliant objects and a keyPath, this method calls valueForKey on each object in the array and groups the contents of the array, using the result of the valueForKey call as a key in a dictionary. |
|
static
|
arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<T> objects,
java.lang.String keyPath,
boolean includeNulls,
java.lang.String valueKeyPath)
Starting with an array of KeyValueCoding-compliant objects and a keyPath, this method calls valueForKey on each object in the array and groups the contents of the array, using the result of the valueForKey call as a key in a dictionary. |
|
static
|
arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<V> objects,
ERXKey<K> keyPath)
Starting with an array of KeyValueCoding-compliant objects and a keyPath, this method calls valueForKey on each object in the array and groups the contents of the array, using the result of the valueForKey call as a key in a dictionary. |
|
static
|
arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<V> objects,
java.lang.String keyPath)
Starting with an array of KeyValueCoding-compliant objects and a keyPath, this method calls valueForKey on each object in the array and groups the contents of the array, using the result of the valueForKey call as a key in a dictionary. |
|
static com.webobjects.foundation.NSDictionary |
arrayGroupedByKeyPath(com.webobjects.foundation.NSArray objects,
java.lang.String keyPath,
java.lang.Object nullGroupingKey,
java.lang.String valueKeyPath)
Starting with an array of KeyValueCoding-compliant objects and a keyPath, this method calls valueForKey on each object in the array and groups the contents of the array, using the result of the valueForKey call as a key in a dictionary. |
|
static
|
arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<T> objects,
ERXKey<K> keyPath,
K nullGroupingKey,
ERXKey<V> valueKeyPath)
Typesafe variant of arrayGroupedByToManyKeyPath. |
|
static
|
arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<V> objects,
ERXKey<K> keyPath,
boolean includeNulls)
Typesafe variant of arrayGroupedByToManyKeyPath. |
|
static
|
arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<V> objects,
ERXKey<K> keyPath,
K nullGroupingKey)
Typesafe variant of arrayGroupedByToManyKeyPath. |
|
static
|
arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<V> objects,
java.lang.String keyPath,
boolean includeNulls)
Groups an array of objects by a given to-many key path, where every single item in the to-many will put the object in the corresponding group. |
|
static
|
arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<V> objects,
java.lang.String keyPath,
K nullGroupingKey)
Groups an array of objects by a given to-many key path, where every single item in the to-many will put the object in the corresponding group. |
|
static com.webobjects.foundation.NSDictionary |
arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray objects,
java.lang.String keyPath,
java.lang.Object nullGroupingKey,
java.lang.String valueKeyPath)
Groups an array of objects by a given to-many key path, where every single item in the to-many will put the object in the corresponding group. |
|
static
|
arrayMinusArray(com.webobjects.foundation.NSArray<T> main,
com.webobjects.foundation.NSArray<?> minus)
Subtracts the contents of one array from another. |
|
static
|
arrayMinusObject(com.webobjects.foundation.NSArray<T> main,
java.lang.Object object)
Subtracts a single object from an array. |
|
static
|
arraysAreIdenticalSets(com.webobjects.foundation.NSArray<? super T> a1,
com.webobjects.foundation.NSArray<? super T> a2)
Simple comparision method to see if two array objects are identical sets. |
|
static
|
arrayWithObjectsAtIndexesSwapped(com.webobjects.foundation.NSArray<T> array,
int indexOfObject1,
int indexOfObject2)
Swaps the two objects at the given indexes in the given NSArray and
returns a new NSArray . |
|
static
|
arrayWithObjectsSwapped(com.webobjects.foundation.NSArray<T> array,
java.lang.Object object1,
java.lang.Object object2)
Swaps the two given Object s in the given NSArray and
returns a new NSArray . |
|
static
|
arrayWithoutDuplicateKeyValue(com.webobjects.foundation.NSArray<T> objects,
java.lang.String key)
Filters out duplicates of an array of objects based on the value of the given key path off of those objects. |
|
static
|
arrayWithoutDuplicates(com.webobjects.foundation.NSArray<T> anArray)
Filters out all of the duplicate objects in a given array. Preserves the order now. |
|
static
|
batchedArrayWithSize(com.webobjects.foundation.NSArray<T> array,
int batchSize)
Batches an NSArray into sub-arrays of the given size. |
|
static
|
deepClone(com.webobjects.foundation.NSArray<T> array,
boolean onlyCollections)
Returns a deep clone of the given array. |
|
static
|
deepClone(com.webobjects.foundation.NSSet<T> set,
boolean onlyCollections)
Returns a deep clone of the given set. |
|
static
|
dictionaryOfObjectsIndexedByKeyPath(com.webobjects.foundation.NSArray<T> array,
java.lang.String keyPath)
Calls dictionaryOfObjectsIndexedByKeyPathThrowOnCollision() passing false for throwOnCollision. |
|
static
|
dictionaryOfObjectsIndexedByKeyPathThrowOnCollision(com.webobjects.foundation.NSArray<T> array,
java.lang.String keyPath,
boolean throwOnCollision)
Given an array of objects, returns a dictionary mapping the value by performing valueForKeyPath on each object in the array to the object in the array. |
|
static
|
distinct(com.webobjects.foundation.NSArray<T> array)
Shorter name for arrayWithoutDuplicates, which I always forget the name of. |
|
static boolean |
enumerationHasMatchWithQualifierEvaluation(java.util.Enumeration<?> enumeration,
com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
Filters any kinds of collections that implements Enumeration
interface such as NSArray , NSSet , Vector
and Hashtable using the EOQualifierEvaluation interface. |
|
static
|
filteredArrayWithEntityFetchSpecification(com.webobjects.foundation.NSArray<T> array,
java.lang.String entity,
java.lang.String fetchSpec)
Filters a given array with a named fetch specification. |
|
static
|
filteredArrayWithEntityFetchSpecification(com.webobjects.foundation.NSArray<T> array,
java.lang.String entity,
java.lang.String fetchSpec,
com.webobjects.foundation.NSDictionary<java.lang.String,?> bindings)
Filters a given array with a named fetch specification and bindings. |
|
static
|
filteredArrayWithFetchSpecificationNamedEntityNamed(com.webobjects.foundation.NSArray<T> array,
java.lang.String fetchSpec,
java.lang.String entity)
Deprecated. |
|
static
|
filteredArrayWithFetchSpecificationNamedEntityNamedBindings(com.webobjects.foundation.NSArray<T> array,
java.lang.String fetchSpec,
java.lang.String entity,
com.webobjects.foundation.NSDictionary<java.lang.String,?> bindings)
Deprecated. |
|
static
|
filteredArrayWithQualifierEvaluation(java.util.Enumeration<T> enumeration,
com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
Filters any kinds of collections that implements Enumeration
interface such as NSArray , NSSet , Vector
and Hashtable using the EOQualifierEvaluation interface. |
|
static
|
filteredArrayWithQualifierEvaluation(java.util.Iterator<T> iterator,
com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
Filters any kind of collections that implements Iterator
interface such as ArrayList , HashMap , SortedSet
and TreeSet using the EOQualifierEvaluation interface. |
|
static
|
filteredArrayWithQualifierEvaluation(com.webobjects.foundation.NSArray<T> array,
com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
Filters an array using the EOQualifierEvaluation interface. |
|
static
|
firstObject(com.webobjects.foundation.NSArray<T> array)
Returns the first object of the array. |
|
static
|
firstObjectWithValueForKeyPath(com.webobjects.foundation.NSArray<T> array,
java.lang.Object value,
java.lang.String keyPath)
Finds the first object in the array with a given value for a given key path. |
|
static com.webobjects.foundation.NSArray |
flatten(com.webobjects.foundation.NSArray<?> originalArray)
Recursively flattens an array of arrays and individual objects into a single array of elements. For example: NSArray foos; //Assume existsNSArray bars = (NSArray)foos.valueForKey("toBars");
In this case if foos contained five elements
then the array bars will contain five arrays
each corresponding to what aFoo.toBars would
return. |
|
static com.webobjects.foundation.NSArray |
flatten(com.webobjects.foundation.NSArray<?> originalArray,
boolean filterDuplicates)
Recursively flattens an array of arrays and individual objects into a single array of elements. For example: NSArray foos; //Assume existsNSArray bars = (NSArray)foos.valueForKey("toBars");
In this case if foos contained five elements
then the array bars will contain five arrays
each corresponding to what aFoo.toBars would
return. |
|
static java.lang.String |
friendlyDisplayForKeyPath(com.webobjects.foundation.NSArray<?> list,
java.lang.String attribute,
java.lang.String nullArrayDisplay,
java.lang.String separator,
java.lang.String finalSeparator)
Displays a list of attributes off of objects in a 'friendly' manner. |
|
static int |
indexOfFirstObjectWithValueForKeyPath(com.webobjects.foundation.NSArray<?> array,
java.lang.Object value,
java.lang.String keyPath)
Finds the index of the first object in the array with a given value for a given keypath. |
|
static
|
indexOfObjectUsingEqualator(com.webobjects.foundation.NSArray<T> array,
T object,
ERXEqualator equalator)
Locates an object within an array using a custom equality check provided as an ERXEqualator. |
|
static void |
initialize()
Will register new NSArray operators sort, sortAsc, sortDesc, sortInsensitiveAsc, sortInsensitiveDesc, unique, flatten, reverse, limit, and fetchSpec |
|
static
|
intersectingElements(com.webobjects.foundation.NSArray<? extends T> array1,
com.webobjects.foundation.NSArray<? extends T> array2)
Intersects the elements of two arrays. |
|
static boolean |
iteratorHasMatchWithQualifierEvaluation(java.util.Iterator<?> iterator,
com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
Filters any kinds of collections that implements Iterator
interface such as NSArray , NSSet , Vector
and Hashtable using the EOQualifierEvaluation interface. |
|
static java.lang.Number |
median(com.webobjects.foundation.NSArray<?> array,
java.lang.String keypath)
Calculates the median value of an array. |
|
static java.lang.String[] |
objectArrayCastToStringArray(java.lang.Object[] o)
Converts an Object array to a String array by casting each element. |
|
static java.lang.String |
objectArraysToString(com.webobjects.foundation.NSArray<java.lang.Object[][]> array)
pretty prints a NSArray of two dimensional Object array which is ugly when using toString |
|
static java.lang.String |
objectArrayToString(java.lang.Object[] o)
pretty prints an Object array which is ugly when using toString |
|
static java.lang.String |
objectArrayToString(java.lang.Object[][] array)
pretty prints a two dimensional Object array which is ugly when using toString |
|
static
|
objectsWithValueForKeyPath(com.webobjects.foundation.NSArray<T> array,
java.lang.Object valueToLookFor,
java.lang.String keyPath)
Walks over an array and returns an array of objects from that array that have a particular value for a particular key path. |
|
static
|
removeNullValues(com.webobjects.foundation.NSArray<T> array)
Removes all occurencies of NSKeyValueCoding.NullValue in the provided array |
|
static
|
removeNullValues(com.webobjects.foundation.NSArray<T> target,
com.webobjects.foundation.NSArray<T> array)
Removes all occurencies of NSKeyValueCoding.NullValue in the provided array |
|
static
|
removeNullValuesFromEnd(com.webobjects.foundation.NSArray<T> array)
removes all occurencies of NSKeyValueCoding.Null from the end of the array |
|
static
|
reverse(com.webobjects.foundation.NSArray<T> array)
Reverses the elements of an array |
|
static
|
safeAddObject(com.webobjects.foundation.NSMutableArray<T> array,
T object)
Adds the object to the mutable array if the object is not null. |
|
static
|
setFromArray(com.webobjects.foundation.NSArray<T> array)
Simply utility method to create a concrete set object from an array. |
|
static
|
shiftObjectLeft(com.webobjects.foundation.NSMutableArray<T> array,
T object)
shifts a given object in an array one value to the left (index--). |
|
static
|
shiftObjectRight(com.webobjects.foundation.NSMutableArray<T> array,
T object)
shifts a given object in an array one value to the right (index++). |
|
static void |
sortArrayWithKey(com.webobjects.foundation.NSMutableArray<?> array,
java.lang.String key)
Sorts a given mutable array with a key in place. |
|
static void |
sortArrayWithKey(com.webobjects.foundation.NSMutableArray<?> array,
java.lang.String key,
com.webobjects.foundation.NSSelector selector)
Sorts a given mutable array with a key in place. |
|
static
|
sortedArraySortedWithKey(com.webobjects.foundation.NSArray<T> array,
java.lang.String key)
Sorts a given array with a key in ascending fashion. |
|
static
|
sortedArraySortedWithKey(com.webobjects.foundation.NSArray<T> array,
java.lang.String key,
com.webobjects.foundation.NSSelector selector)
Sorts a given array with a key in ascending fashion. |
|
static
|
sortedArraySortedWithKeys(com.webobjects.foundation.NSArray<T> array,
com.webobjects.foundation.NSArray<java.lang.String> keys,
com.webobjects.foundation.NSSelector selector)
Sorts a given array with a set of keys according to the given selector. |
|
static
|
sortedArrayUsingComparator(com.webobjects.foundation.NSArray<T> array,
com.webobjects.foundation.NSComparator comparator)
Just like the method NSArray#sortedArrayUsingComparator(NSComparator) ,
except it catches the NSComparator.ComparisonException and, if thrown,
it wraps it in a runtime exception. |
|
static
|
sortedMutableArraySortedWithKey(com.webobjects.foundation.NSArray<T> array,
java.lang.String key)
Sorts a given array with a key in ascending fashion and returns a mutable clone of the result. |
|
static com.webobjects.foundation.NSSelector |
sortSelectorWithKey(java.lang.String key)
The qualifiers EOSortOrdering.CompareAscending.. |
|
static java.lang.Number |
stdDev(com.webobjects.foundation.NSArray<?> array,
java.lang.String keypath,
boolean isPopulation)
Finds the standard deviation of the numeric values found in the array at the specified keypath. |
|
static
|
swapObjectsAtIndexesInArray(com.webobjects.foundation.NSMutableArray<T> array,
int indexOfA,
int indexOfB)
Swaps two objects at the given indexes in an array inplace |
|
static
|
swapObjectsInArray(com.webobjects.foundation.NSMutableArray<T> array,
T a,
T b)
Swaps two objects a and b in an array inplace |
|
static
|
swapObjectWithObjectAtIndexInArray(com.webobjects.foundation.NSMutableArray<T> array,
T a,
int indexOfB)
Swaps the object a with the object at the given index |
|
static java.lang.String[] |
toStringArray(com.webobjects.foundation.NSArray<?> a)
|
|
static com.webobjects.foundation.NSArray |
valuesForKeyPaths(java.lang.Object array,
com.webobjects.foundation.NSArray<java.lang.String> paths)
Performs multiple key-value coding calls against an array or an object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NULL_GROUPING_KEY
Constructor Detail |
---|
public ERXArrayUtilities()
Method Detail |
---|
public static <T> com.webobjects.foundation.NSSet<T> setFromArray(com.webobjects.foundation.NSArray<T> array)
array
- of elementspublic static com.webobjects.foundation.NSSelector sortSelectorWithKey(java.lang.String key)
key
- sort keypublic static <K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<V> objects, ERXKey<K> keyPath)
See arrayGroupedByKeyPath(NSArray
This method calls arrayGroupedByKeyPath(NSArray objects, String keyPath, Object nullGroupingKey, String valueKeyPath) with includeNulls set to true and valueKeyPath set to null.
objects
- array of objects to be groupedkeyPath
- path into objects used to group the objects
NULL_GROUPING_KEY
public static <K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<V> objects, java.lang.String keyPath)
If one starts with:
( { lastName = "Barker"; firstName = "Bob"; favoriteColor = "blue"; }, { firstName = "Bob"; favoriteColor = "red"; }, { lastName = "Further"; firstName = "Frank"; favoriteColor = "green"; } )and one calls arrayGroupedByKeyPath(objects, "firstName"), one gets:
{ "Bob" = ( { lastName = "Barker"; firstName = "Bob"; favoriteColor = "blue"; }, { firstName = "Bob"; favoriteColor = "red"; } ); "Frank" = ( { lastName = "Further"; firstName = "Frank"; favoriteColor = "green"; } ); }
{ "Bob" = ( { lastName = "Barker"; firstName = "Bob"; favoriteColor = "blue"; } ); "Frank" = ( { lastName = "Further"; firstName = "Frank"; favoriteColor = "green"; } ); "**** NULL GROUPING KEY ****" = ( { firstName = "Bob"; favoriteColor = "red"; } ); }
This method calls arrayGroupedByKeyPath(objects, keyPath, includeNulls, valueKeyPath) with includeNulls set to true and valueKeyPath set to null.
objects
- array of objects to be groupedkeyPath
- path into objects used to group the objects
NULL_GROUPING_KEY
public static <T,K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<T> objects, ERXKey<K> keyPath, boolean includeNulls, ERXKey<V> valueKeyPath)
See arrayGroupedByKeyPath(NSArray
objects
- array of objects to be groupedkeyPath
- path into objects used to group the objectsincludeNulls
- determines if keyPaths that resolve to null
are included in the resulting dictionaryvalueKeyPath
- used to call valueForKey on the arrays in
the results dictionary, with the results of those calls each
replacing the corresponding array in the results dictionary.
NULL_GROUPING_KEY
public static <T,K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<T> objects, java.lang.String keyPath, boolean includeNulls, java.lang.String valueKeyPath)
If one starts with:
( { lastName = "Barker"; firstName = "Bob"; favoriteColor = "blue"; }, { firstName = "Bob"; favoriteColor = "red"; }, { lastName = "Further"; firstName = "Frank"; favoriteColor = "green"; } )and one calls arrayGroupedByKeyPath(objects, "firstName", true, "favoriteColor"), one gets:
{Frank = ("green"); Bob = ("blue", "red");If one calls arrayGroupedByKeyPath(objects, "lastName", false, "favoriteColor"), one gets:
{Further = ("green"); Barker = ("blue"); }If one calls arrayGroupedByKeyPath(objects, "lastName", true, "favoriteColor"), one gets:
{Further = ("green"); Barker = ("blue"); "**** NULL GROUPING KEY ****" = ("red"); }
objects
- array of objects to be groupedkeyPath
- path into objects used to group the objectsincludeNulls
- determines if keyPaths that resolve to null
are included in the resulting dictionaryvalueKeyPath
- used to call valueForKey on the arrays in
the results dictionary, with the results of those calls each
replacing the corresponding array in the results dictionary.
NULL_GROUPING_KEY
public static <T,K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByKeyPath(com.webobjects.foundation.NSArray<T> objects, ERXKey<K> keyPath, K nullGroupingKey, ERXKey<V> valueKeyPath)
See arrayGroupedByKeyPath(NSArray objects, String keyPath, Object nullGroupingKey, String valueKeyPath) for examples.
objects
- array of objects to be groupedkeyPath
- path into objects used to group the objectsnullGroupingKey
- used as the key in the results dictionary
for the array of objects for which the valueForKey with keyPath
result is null.valueKeyPath
- used to call valueForKey on the arrays in
the results dictionary, with the results of those calls each
replacing the corresponding array in the results dictionary.
NULL_GROUPING_KEY
public static com.webobjects.foundation.NSDictionary arrayGroupedByKeyPath(com.webobjects.foundation.NSArray objects, java.lang.String keyPath, java.lang.Object nullGroupingKey, java.lang.String valueKeyPath)
If one starts with:
( { lastName = "Barker"; firstName = "Bob"; favoriteColor = "blue"; }, { firstName = "Bob"; favoriteColor = "red"; }, { lastName = "Further"; firstName = "Frank"; favoriteColor = "green"; } )and one calls arrayGroupedByKeyPath(objects, "firstName", null, "favoriteColor"), one gets:
{Frank = ("green"); Bob = ("blue", "red");If one calls arrayGroupedByKeyPath(objects, "lastName", "extra", "favoriteColor"), one gets:
{Further = ("green"); Barker = ("blue"); "extra" = ("red"); }If one calls arrayGroupedByKeyPath(objects, "lastName", null, "favoriteColor"), one gets:
{Further = ("green"); Barker = ("blue"); "**** NULL GROUPING KEY ****" = ("red"); }
objects
- array of objects to be groupedkeyPath
- path into objects used to group the objectsnullGroupingKey
- used as the key in the results dictionary
for the array of objects for which the valueForKey with keyPath
result is null.valueKeyPath
- used to call valueForKey on the arrays in
the results dictionary, with the results of those calls each
replacing the corresponding array in the results dictionary.
NULL_GROUPING_KEY
public static <K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<V> objects, ERXKey<K> keyPath, boolean includeNulls)
objects
- the objects to be groupedkeyPath
- the key to group byincludeNulls
- determins if the keypaths that resolve to null should be allowed in the group
public static <K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<V> objects, java.lang.String keyPath, boolean includeNulls)
arrayGroupedByToManyKeyPath(users, "roles.name")
would be
"admin" = (user1, user2); "editor" = (user3);...
.
The dictionary that is returned contains keys that correspond to the grouped
keys values. This means that the object pointed to by the key
path must be a cloneable object. For instance using the key path
'users' would not work because enterprise objects are not
cloneable. Instead you might choose to use the key path 'users.name'
of 'users.primaryKey', if your enterprise objects support this
see ERXGenericRecord
if interested.
objects
- array of objects to be groupedkeyPath
- path used to group the objects.includeNulls
- determines if keyPaths that resolve to null
should be allowed into the group.
public static <K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<V> objects, ERXKey<K> keyPath, K nullGroupingKey)
objects
- array of objects to be groupedkeyPath
- path used to group the objects.nullGroupingKey
- if not-null, determines if keyPaths that resolve to null
should be allowed into the group; if so, this key is used for them
public static <K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<V> objects, java.lang.String keyPath, K nullGroupingKey)
ERXGenericRecord
if interested.
objects
- array of objects to be groupedkeyPath
- path used to group the objects.nullGroupingKey
- if not-null, determines if keyPaths that resolve to null
should be allowed into the group; if so, this key is used for them
public static <T,K,V> com.webobjects.foundation.NSDictionary<K,com.webobjects.foundation.NSArray<V>> arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray<T> objects, ERXKey<K> keyPath, K nullGroupingKey, ERXKey<V> valueKeyPath)
objects
- array of objects to be groupedkeyPath
- path used to group the objects.nullGroupingKey
- if not-null, determines if keyPaths that resolve to null
should be allowed into the group; if so, this key is used for themvalueKeyPath
- allows the grouped objects in the result to be
derived from objects (by evaluating valueKeyPath), instead
of being members of the objects collection. Objects that
evaluate valueKeyPath to null have no value included in the
result
public static com.webobjects.foundation.NSDictionary arrayGroupedByToManyKeyPath(com.webobjects.foundation.NSArray objects, java.lang.String keyPath, java.lang.Object nullGroupingKey, java.lang.String valueKeyPath)
ERXGenericRecord
if interested.
objects
- array of objects to be groupedkeyPath
- path used to group the objects.nullGroupingKey
- if not-null, determines if keyPaths that resolve to null
should be allowed into the group; if so, this key is used for themvalueKeyPath
- allows the grouped objects in the result to be
derived from objects (by evaluating valueKeyPath), instead
of being members of the objects collection. Objects that
evaluate valueKeyPath to null have no value included in the
result
public static <T> boolean arraysAreIdenticalSets(com.webobjects.foundation.NSArray<? super T> a1, com.webobjects.foundation.NSArray<? super T> a2)
a1
- first arraya2
- second array
public static <T> com.webobjects.foundation.NSArray<T> filteredArrayWithQualifierEvaluation(com.webobjects.foundation.NSArray<T> array, com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
EOQualifierEvaluation
interface.
array
- to be filteredqualifier
- to do the filtering
public static <T> com.webobjects.foundation.NSArray<T> filteredArrayWithQualifierEvaluation(java.util.Enumeration<T> enumeration, com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
Enumeration
interface such as NSArray
, NSSet
, Vector
and Hashtable
using the EOQualifierEvaluation
interface.
enumeration
- to be filtered; to obtain an enumeration,
use objectEnumerator() for the collections in
com.webobjects.foundation package
and use elements() for the Vector and Hashtablequalifier
- to do the filtering
public static boolean enumerationHasMatchWithQualifierEvaluation(java.util.Enumeration<?> enumeration, com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
Enumeration
interface such as NSArray
, NSSet
, Vector
and Hashtable
using the EOQualifierEvaluation
interface.
enumeration
- to be filtered; to obtain an enumeration,
use objectEnumerator() for the collections in
com.webobjects.foundation package
and use elements() for the Vector and Hashtablequalifier
- to do the filtering
public static boolean iteratorHasMatchWithQualifierEvaluation(java.util.Iterator<?> iterator, com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
Iterator
interface such as NSArray
, NSSet
, Vector
and Hashtable
using the EOQualifierEvaluation
interface.
iterator
- to be filtered; to obtain an iterator,
use iterator() for the java collectionsqualifier
- to do the filtering
public static <T> com.webobjects.foundation.NSArray<T> filteredArrayWithQualifierEvaluation(java.util.Iterator<T> iterator, com.webobjects.eocontrol.EOQualifierEvaluation qualifier)
Iterator
interface such as ArrayList
, HashMap
, SortedSet
and TreeSet
using the EOQualifierEvaluation
interface.
iterator
- to be filtered; use iterator() to obtain
an iterator from the collectionsqualifier
- to do the filtering
public static <T> com.webobjects.foundation.NSArray<T> arrayWithoutDuplicateKeyValue(com.webobjects.foundation.NSArray<T> objects, java.lang.String key)
objects
- array of objectskey
- keypath to be evaluated off of every object
public static <T> com.webobjects.foundation.NSArray<T> arrayMinusArray(com.webobjects.foundation.NSArray<T> main, com.webobjects.foundation.NSArray<?> minus)
main
- array to have values removed from it.minus
- array of values to remove from the main array
public static <T> com.webobjects.foundation.NSArray<T> arrayMinusObject(com.webobjects.foundation.NSArray<T> main, java.lang.Object object)
main
- array to have value removed from it.object
- to be removed
public static <T> com.webobjects.foundation.NSArray<T> arrayByAddingObjectsFromArrayWithoutDuplicates(com.webobjects.foundation.NSArray<? extends T> a1, com.webobjects.foundation.NSArray<? extends T> a2)
a1
- first arraya2
- second array
public static <T> com.webobjects.foundation.NSArray<T> arrayByRemovingFirstObject(com.webobjects.foundation.NSArray<T> array)
array
- the array to use to create the result
public static <T> void safeAddObject(com.webobjects.foundation.NSMutableArray<T> array, T object)
array
- mutable array where non-null object will be addedobject
- to be added to arraypublic static <T> void addObjectsFromArrayWithoutDuplicates(com.webobjects.foundation.NSMutableArray<T> a1, com.webobjects.foundation.NSArray<? extends T> a2)
a1
- mutable array where non-duplicate objects are
addeda2
- array to be added to a1public static com.webobjects.foundation.NSArray flatten(com.webobjects.foundation.NSArray<?> originalArray, boolean filterDuplicates)
NSArray foos;
//Assume existsNSArray bars = (NSArray)foos.valueForKey("toBars");
In this case if foos
contained five elements
then the array bars
will contain five arrays
each corresponding to what aFoo.toBars
would
return. To have the entire collection of bars
in one single array you would call:
NSArray allBars = flatten(bars)
originalArray
- array to be flattenedfilterDuplicates
- determines if the duplicate values
should be filtered
public static com.webobjects.foundation.NSArray flatten(com.webobjects.foundation.NSArray<?> originalArray)
NSArray foos;
//Assume existsNSArray bars = (NSArray)foos.valueForKey("toBars");
In this case if foos
contained five elements
then the array bars
will contain five arrays
each corresponding to what aFoo.toBars
would
return. To have the entire collection of bars
in one single array you would call:
NSArray allBars = flatten(bars)
originalArray
- array to be flattened
public static com.webobjects.foundation.NSArray arrayFromPropertyList(java.lang.String name, com.webobjects.foundation.NSBundle bundle)
name
- name of the file or resource.bundle
- NSBundle to which the resource belongs.
public static com.webobjects.foundation.NSArray valuesForKeyPaths(java.lang.Object array, com.webobjects.foundation.NSArray<java.lang.String> paths)
array
- collection or object to be acted upon.paths
- array of keypaths.
public static <T> T firstObject(com.webobjects.foundation.NSArray<T> array)
array
- the array to search.
public static int indexOfFirstObjectWithValueForKeyPath(com.webobjects.foundation.NSArray<?> array, java.lang.Object value, java.lang.String keyPath)
array
- the array to search.value
- the value to look for.keyPath
- the keypath to use to compare to value.
public static <T> T firstObjectWithValueForKeyPath(com.webobjects.foundation.NSArray<T> array, java.lang.Object value, java.lang.String keyPath)
array
- the array to search.value
- the value to look for.keyPath
- the keypath to use to compare to value.
public static <T> com.webobjects.foundation.NSArray<T> objectsWithValueForKeyPath(com.webobjects.foundation.NSArray<T> array, java.lang.Object valueToLookFor, java.lang.String keyPath)
array
- array to searchvalueToLookFor
- value to look forkeyPath
- key path to apply on each object on the array to compare against valueToLookFor
public static <T> int indexOfObjectUsingEqualator(com.webobjects.foundation.NSArray<T> array, T object, ERXEqualator equalator)
array
- the array to search.object
- the object to look for.equalator
- the equalator to use for performing the equality check between object and each object
in the array.
public static <T> com.webobjects.foundation.NSMutableArray<T> sortedMutableArraySortedWithKey(com.webobjects.foundation.NSArray<T> array, java.lang.String key)
array
- array to be sorted.key
- sort key.
public static <T> com.webobjects.foundation.NSArray<T> sortedArraySortedWithKey(com.webobjects.foundation.NSArray<T> array, java.lang.String key)
array
- array to be sorted.key
- sort key.
public static <T> com.webobjects.foundation.NSArray<T> sortedArraySortedWithKey(com.webobjects.foundation.NSArray<T> array, java.lang.String key, com.webobjects.foundation.NSSelector selector)
array
- array to be sorted.key
- sort key.selector
- sort order selector to use, if null, then sort will be case insensitive ascending.
public static <T> com.webobjects.foundation.NSArray<T> sortedArraySortedWithKeys(com.webobjects.foundation.NSArray<T> array, com.webobjects.foundation.NSArray<java.lang.String> keys, com.webobjects.foundation.NSSelector selector)
array
- array to be sorted.keys
- sort keysselector
- sort order selector to use, if null, then sort will be case insensitive ascending.
public static void sortArrayWithKey(com.webobjects.foundation.NSMutableArray<?> array, java.lang.String key)
array
- array to be sorted.key
- sort key.public static void sortArrayWithKey(com.webobjects.foundation.NSMutableArray<?> array, java.lang.String key, com.webobjects.foundation.NSSelector selector)
array
- array to be sorted.key
- sort key.selector
- sort order selector to use, if null, then sort will be ascending.public static void initialize()
public static java.lang.Number median(com.webobjects.foundation.NSArray<?> array, java.lang.String keypath)
array
- array of objectskeypath
- key path for the median
public static java.lang.Number stdDev(com.webobjects.foundation.NSArray<?> array, java.lang.String keypath, boolean isPopulation)
array
- an array of objectskeypath
- a key path to a numeric value on each objectisPopulation
-
public static <T> com.webobjects.foundation.NSArray<T> distinct(com.webobjects.foundation.NSArray<T> array)
T
- type of the arrayarray
- the array to return distinct values from
public static <T> com.webobjects.foundation.NSArray<T> arrayWithoutDuplicates(com.webobjects.foundation.NSArray<T> anArray)
anArray
- to be filtered
public static <T> com.webobjects.foundation.NSArray<com.webobjects.foundation.NSArray<T>> batchedArrayWithSize(com.webobjects.foundation.NSArray<T> array, int batchSize)
array
- array to batchbatchSize
- number of items in each batch
public static <T> com.webobjects.foundation.NSArray<T> filteredArrayWithEntityFetchSpecification(com.webobjects.foundation.NSArray<T> array, java.lang.String entity, java.lang.String fetchSpec, com.webobjects.foundation.NSDictionary<java.lang.String,?> bindings)
array
- array to be filtered.fetchSpec
- name of the EOQualifierEvaluation
.entity
- name of the EOEntity
to which the fetch specification is associated.bindings
- bindings dictionary for qualifier variable substitution.
public static <T> com.webobjects.foundation.NSArray<T> filteredArrayWithFetchSpecificationNamedEntityNamedBindings(com.webobjects.foundation.NSArray<T> array, java.lang.String fetchSpec, java.lang.String entity, com.webobjects.foundation.NSDictionary<java.lang.String,?> bindings)
public static <T> com.webobjects.foundation.NSArray<T> filteredArrayWithFetchSpecificationNamedEntityNamed(com.webobjects.foundation.NSArray<T> array, java.lang.String fetchSpec, java.lang.String entity)
public static <T> com.webobjects.foundation.NSArray<T> filteredArrayWithEntityFetchSpecification(com.webobjects.foundation.NSArray<T> array, java.lang.String entity, java.lang.String fetchSpec)
array
- array to be filtered.fetchSpec
- name of the EOQualifierEvaluation
.entity
- name of the EOEntity
to which the fetch specification is associated.
public static <T> void shiftObjectLeft(com.webobjects.foundation.NSMutableArray<T> array, T object)
array
- array to be modified.object
- the object that should be movedpublic static <T> void shiftObjectRight(com.webobjects.foundation.NSMutableArray<T> array, T object)
array
- array to be modified.object
- the object that should be movedpublic static <T> boolean arrayContainsAnyObjectFromArray(com.webobjects.foundation.NSArray<? extends T> array, com.webobjects.foundation.NSArray<? extends T> objects)
array
- to test if it contains any of the objectsobjects
- array of objects to test if the first array
contains any of
public static <T> boolean arrayContainsArray(com.webobjects.foundation.NSArray<? extends T> array, com.webobjects.foundation.NSArray<? extends T> objects)
array
- to test if it contains all of the objects of another arrayobjects
- array of objects to test if the first array
contains all of
public static <T> com.webobjects.foundation.NSArray<T> intersectingElements(com.webobjects.foundation.NSArray<? extends T> array1, com.webobjects.foundation.NSArray<? extends T> array2)
array1
- the first arrayarray2
- the second array
public static <T> com.webobjects.foundation.NSArray<T> reverse(com.webobjects.foundation.NSArray<T> array)
array
- to be reversed
public static java.lang.String friendlyDisplayForKeyPath(com.webobjects.foundation.NSArray<?> list, java.lang.String attribute, java.lang.String nullArrayDisplay, java.lang.String separator, java.lang.String finalSeparator)
list
- of objects to be displayed in a friendly
mannerattribute
- key to be called on each object in
the listnullArrayDisplay
- string to be returned if the
list is null or emptyseparator
- string to be used for the first itemsfinalSeparator
- used between the last items
public static com.webobjects.foundation.NSArray<?> arrayForKeysPath(com.webobjects.foundation.NSArray<?> array, com.webobjects.foundation.NSArray<java.lang.String> keys)
array
- array of objectskeys
- array of keys
public static <T> com.webobjects.foundation.NSArray<T> removeNullValues(com.webobjects.foundation.NSArray<T> array)
array
- the array from which the NullValue should be removed
public static <T> com.webobjects.foundation.NSArray<T> removeNullValues(com.webobjects.foundation.NSArray<T> target, com.webobjects.foundation.NSArray<T> array)
target
- array to remove objects fromarray
- array of values
public static java.lang.String[] objectArrayCastToStringArray(java.lang.Object[] o)
String[] myStringArray = (String[])myObjectArray;
except that it creates a clone of the array.
o
- an Object array containing String elements
public static java.lang.String objectArrayToString(java.lang.Object[] o)
o
- the object which one wants to print as a String
log.info("my array = "+ERXArrayUtilities.objectArrayToString(myArray));
public static java.lang.String objectArrayToString(java.lang.Object[][] array)
array
- the object which one wants to print as a String
log.info("my array = "+ERXArrayUtilities.objectArrayToString(myArray));
public static java.lang.String objectArraysToString(com.webobjects.foundation.NSArray<java.lang.Object[][]> array)
array
- the object which one wants to print as a String
log.info("my array = "+ERXArrayUtilities.objectArrayToString(myArray));
public static <T> com.webobjects.foundation.NSArray<T> removeNullValuesFromEnd(com.webobjects.foundation.NSArray<T> array)
array
- the array from which the values should be removed
public static java.lang.String[] toStringArray(com.webobjects.foundation.NSArray<?> a)
public static <K,T> com.webobjects.foundation.NSDictionary<K,T> dictionaryOfObjectsIndexedByKeyPath(com.webobjects.foundation.NSArray<T> array, java.lang.String keyPath)
public static <K,T> com.webobjects.foundation.NSDictionary<K,T> dictionaryOfObjectsIndexedByKeyPathThrowOnCollision(com.webobjects.foundation.NSArray<T> array, java.lang.String keyPath, boolean throwOnCollision)
arrayGroupedByKeyPath()
. That method is focused on multiple objects returning the same value for the keypath
and, so, objects are grouped into arrays. That is not particularly useful when there aren't collisions in the array or when
you don't care if there are collisions. For example, with a CreditCard EO object, one could rely on the paymentType.name value
to be unique and thus you're more interested in being able to rapidly get to the EO. arrayGroupedByKeyPath()
would require either flattening out the arrays or navigating them everytime.
array
- array to indexkeyPath
- keyPath to index. if any object returns null of NSKeyValueCoding.NullValue for this keyPath, the
object is not put into the resulting dictionary.throwOnCollision
- if true and two objects in the array have the same non-null (or non-NullValue) value for keyPath,
an exception is thrown. if false, the last object in the array wins.
public static <T> com.webobjects.foundation.NSArray<T> arrayBySelectingInstancesOfClass(com.webobjects.foundation.NSArray<?> array, java.lang.Class<T> aClass)
array
- array to processaClass
- class to use. null results in the result being a copy of the array
.
array
where each object in the result is
an instance of aClass
.public static <T> com.webobjects.foundation.NSArray<T> sortedArrayUsingComparator(com.webobjects.foundation.NSArray<T> array, com.webobjects.foundation.NSComparator comparator)
NSArray#sortedArrayUsingComparator(NSComparator)
,
except it catches the NSComparator.ComparisonException and, if thrown,
it wraps it in a runtime exception. Returns null when passed null for array.
T
- array
- comparator
-
public static <T> com.webobjects.foundation.NSArray<T> arrayWithObjectsSwapped(com.webobjects.foundation.NSArray<T> array, java.lang.Object object1, java.lang.Object object2)
Object
s in the given NSArray
and
returns a new NSArray
. If one of the Object
s is not
element of the NSArray
a RuntimeException
will be thrown.
T
- array
- in that the two given Object
s have to be swappedobject1
- one object in the NSArray
that will be swappedobject2
- the other object in the NSArray
that will be swapped
NSArray
with the swapped elements
{@link
- RuntimeException}
if one of the Object
s is not in the NSArray
public static <T> com.webobjects.foundation.NSArray<T> arrayWithObjectsAtIndexesSwapped(com.webobjects.foundation.NSArray<T> array, int indexOfObject1, int indexOfObject2)
NSArray
and
returns a new NSArray
.
array
- in that the two Object
s at the given indexes have to be swappedindexOfObject1
- index of one object in the NSArray
that will be swappedindexOfObject2
- index of the other object in the NSArray
that will be swapped
NSArray
with the swapped elements
{@link
- RuntimeException} if one of the indexes is out of boundpublic static <T> void swapObjectsInArray(com.webobjects.foundation.NSMutableArray<T> array, T a, T b)
array
- the arraya
- - first objectb
- - second object
{@link
- RuntimeException} if one or both indexes are out of boundspublic static <T> void swapObjectsAtIndexesInArray(com.webobjects.foundation.NSMutableArray<T> array, int indexOfA, int indexOfB)
array
- the arrayindexOfA
- - index of the first objectindexOfB
- - index of the second object
{@link
- RuntimeException} if one or both indexes are out of boundspublic static <T> void swapObjectWithObjectAtIndexInArray(com.webobjects.foundation.NSMutableArray<T> array, T a, int indexOfB)
array
- the arraya
- - first objectindexOfB
- - index of second objectpublic static <T> com.webobjects.foundation.NSArray<T> deepClone(com.webobjects.foundation.NSArray<T> array, boolean onlyCollections)
array
- the array to cloneonlyCollections
- if true, only collections in this array will be cloned, not individual values
public static <T> com.webobjects.foundation.NSSet<T> deepClone(com.webobjects.foundation.NSSet<T> set, boolean onlyCollections)
set
- the set to cloneonlyCollections
- if true, only collections in this array will be cloned, not individual values
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |