
Classes | |
| class | AvgNonNullOperator |
| class | BaseOperator |
| class | FetchSpecOperator |
| class | FlattenOperator |
| class | IsEmptyOperator |
| class | LimitOperator |
| class | MedianOperator |
| class | ObjectAtIndexOperator |
| class | RemoveNullValuesOperator |
| class | ReverseOperator |
| class | SortOperator |
| class | StandardDeviationOperator |
| class | SubarrayWithRangeOperator |
| class | UniqueOperator |
Static Public Member Functions | |
| static< T > void | addObjectsFromArrayWithoutDuplicates (NSMutableArray< T > a1, NSArray<?extends T > a2) |
| static< T > NSArray< T > | arrayByAddingObjectsFromArrayWithoutDuplicates (NSArray<?extends T > a1, NSArray<?extends T > a2) |
| static< T > NSArray< T > | arrayByRemovingFirstObject (NSArray< T > array) |
| static< T > NSArray< T > | arrayBySelectingInstancesOfClass (final NSArray<?> array, final Class< T > aClass) |
| static< T > boolean | arrayContainsAnyObjectFromArray (NSArray<?extends T > array, NSArray<?extends T > objects) |
| static< T > boolean | arrayContainsArray (NSArray<?extends T > array, NSArray<?extends T > objects) |
| static NSArray<?> | arrayForKeysPath (NSArray<?> array, NSArray< String > keys) |
| static NSArray | arrayFromPropertyList (String name, NSBundle bundle) |
| static NSDictionary | arrayGroupedByKeyPath (NSArray objects, String keyPath, Object nullGroupingKey, String valueKeyPath) |
| static< T, K, V > NSDictionary < K, NSArray< V > > | arrayGroupedByKeyPath (NSArray< T > objects, ERXKey< K > keyPath, K nullGroupingKey, ERXKey< V > valueKeyPath) |
| static< T, K, V > NSDictionary < K, NSArray< V > > | arrayGroupedByKeyPath (NSArray< T > objects, String keyPath, boolean includeNulls, String valueKeyPath) |
| static< T, K, V > NSDictionary < K, NSArray< V > > | arrayGroupedByKeyPath (NSArray< T > objects, ERXKey< K > keyPath, boolean includeNulls, ERXKey< V > valueKeyPath) |
| static< K, V > NSDictionary< K, NSArray< V > > | arrayGroupedByKeyPath (NSArray< V > objects, String keyPath) |
| static< K, V > NSDictionary< K, NSArray< V > > | arrayGroupedByKeyPath (NSArray< V > objects, ERXKey< K > keyPath) |
| static NSDictionary | arrayGroupedByToManyKeyPath (NSArray objects, String keyPath, Object nullGroupingKey, String valueKeyPath) |
| static< T, K, V > NSDictionary < K, NSArray< V > > | arrayGroupedByToManyKeyPath (NSArray< T > objects, ERXKey< K > keyPath, K nullGroupingKey, ERXKey< V > valueKeyPath) |
| static< K, V > NSDictionary< K, NSArray< V > > | arrayGroupedByToManyKeyPath (NSArray< V > objects, String keyPath, K nullGroupingKey) |
| static< K, V > NSDictionary< K, NSArray< V > > | arrayGroupedByToManyKeyPath (NSArray< V > objects, ERXKey< K > keyPath, K nullGroupingKey) |
| static< K, V > NSDictionary< K, NSArray< V > > | arrayGroupedByToManyKeyPath (NSArray< V > objects, String keyPath, boolean includeNulls) |
| static< K, V > NSDictionary< K, NSArray< V > > | arrayGroupedByToManyKeyPath (NSArray< V > objects, ERXKey< K > keyPath, boolean includeNulls) |
| static< T > NSArray< T > | arrayMinusArray (NSArray< T > main, NSArray<?> minus) |
| static< T > NSArray< T > | arrayMinusObject (NSArray< T > main, Object object) |
| static< T > boolean | arraysAreIdenticalSets (NSArray<?super T > a1, NSArray<?super T > a2) |
| static< T > NSArray< T > | arrayWithObjectsAtIndexesSwapped (final NSArray< T > array, final int indexOfObject1, final int indexOfObject2) |
| static< T > NSArray< T > | arrayWithObjectsSwapped (final NSArray< T > array, final Object object1, final Object object2) |
| static< T > NSArray< T > | arrayWithoutDuplicateKeyValue (NSArray< T > objects, String key) |
| static< T > NSArray< T > | arrayWithoutDuplicates (NSArray< T > anArray) |
| static< T > NSArray< NSArray< T > > | batchedArrayWithSize (NSArray< T > array, int batchSize) |
| static< T > NSSet< T > | deepClone (NSSet< T > set, boolean onlyCollections) |
| static< T > NSArray< T > | deepClone (NSArray< T > array, boolean onlyCollections) |
| static< K, T > NSDictionary< K, T > | dictionaryOfObjectsIndexedByKeyPath (final NSArray< T > array, final String keyPath) |
| static< K, T > NSDictionary< K, T > | dictionaryOfObjectsIndexedByKeyPathThrowOnCollision (final NSArray< T > array, final String keyPath, final boolean throwOnCollision) |
| static< T > NSArray< T > | distinct (NSArray< T > array) |
| static boolean | enumerationHasMatchWithQualifierEvaluation (Enumeration<?> enumeration, EOQualifierEvaluation qualifier) |
| static< T > NSArray< T > | filteredArrayWithEntityFetchSpecification (NSArray< T > array, String entity, String fetchSpec) |
| static< T > NSArray< T > | filteredArrayWithEntityFetchSpecification (NSArray< T > array, String entity, String fetchSpec, NSDictionary< String,?> bindings) |
| static< T > NSArray< T > | filteredArrayWithFetchSpecificationNamedEntityNamed (NSArray< T > array, String fetchSpec, String entity) |
| static< T > NSArray< T > | filteredArrayWithFetchSpecificationNamedEntityNamedBindings (NSArray< T > array, String fetchSpec, String entity, NSDictionary< String,?> bindings) |
| static< T > NSArray< T > | filteredArrayWithQualifierEvaluation (Iterator< T > iterator, EOQualifierEvaluation qualifier) |
| static< T > NSArray< T > | filteredArrayWithQualifierEvaluation (Enumeration< T > enumeration, EOQualifierEvaluation qualifier) |
| static< T > NSArray< T > | filteredArrayWithQualifierEvaluation (NSArray< T > array, EOQualifierEvaluation qualifier) |
| static< T > T | firstObject (NSArray< T > array) |
| static< T > T | firstObjectWithValueForKeyPath (NSArray< T > array, Object value, String keyPath) |
| static NSArray | flatten (NSArray<?> originalArray) |
| static NSArray | flatten (NSArray<?> originalArray, boolean filterDuplicates) |
| static String | friendlyDisplayForKeyPath (NSArray<?> list, String attribute, String nullArrayDisplay, String separator, String finalSeparator) |
| static int | indexOfFirstObjectWithValueForKeyPath (NSArray<?> array, Object value, String keyPath) |
| static< T > int | indexOfObjectUsingEqualator (NSArray< T > array, T object, ERXEqualator equalator) |
| static void | initialize () |
| static< T > NSArray< T > | intersectingElements (NSArray<?extends T > array1, NSArray<?extends T > array2) |
| static boolean | iteratorHasMatchWithQualifierEvaluation (Iterator<?> iterator, EOQualifierEvaluation qualifier) |
| static Number | median (NSArray<?> array, String keypath) |
| static String[] | objectArrayCastToStringArray (Object[] o) |
| static String | objectArraysToString (NSArray< Object[][]> array) |
| static String | objectArrayToString (Object[][] array) |
| static String | objectArrayToString (Object[] o) |
| static< T > NSArray< T > | objectsWithValueForKeyPath (final NSArray< T > array, final Object valueToLookFor, final String keyPath) |
| static< T > NSArray< T > | removeNullValues (NSArray< T > target, NSArray< T > array) |
| static< T > NSArray< T > | removeNullValues (NSArray< T > array) |
| static< T > NSArray< T > | removeNullValuesFromEnd (NSArray< T > array) |
| static< T > NSArray< T > | reverse (NSArray< T > array) |
| static< T > void | safeAddObject (NSMutableArray< T > array, T object) |
| static< T > NSSet< T > | setFromArray (NSArray< T > array) |
| static< T > void | shiftObjectLeft (NSMutableArray< T > array, T object) |
| static< T > void | shiftObjectRight (NSMutableArray< T > array, T object) |
| static void | sortArrayWithKey (NSMutableArray<?> array, String key, NSSelector selector) |
| static void | sortArrayWithKey (NSMutableArray<?> array, String key) |
| static< T > NSArray< T > | sortedArraySortedWithKey (NSArray< T > array, String key, NSSelector selector) |
| static< T > NSArray< T > | sortedArraySortedWithKey (NSArray< T > array, String key) |
| static< T > NSArray< T > | sortedArraySortedWithKeys (NSArray< T > array, NSArray< String > keys, NSSelector selector) |
| static< T > NSArray< T > | sortedArrayUsingComparator (final NSArray< T > array, final NSComparator comparator) |
| static< T > NSMutableArray< T > | sortedMutableArraySortedWithKey (NSArray< T > array, String key) |
| static NSSelector | sortSelectorWithKey (String key) |
| static Number | stdDev (NSArray<?> array, String keypath, boolean isPopulation) |
| static< T > void | swapObjectsAtIndexesInArray (NSMutableArray< T > array, int indexOfA, int indexOfB) |
| static< T > void | swapObjectsInArray (NSMutableArray< T > array, T a, T b) |
| static< T > void | swapObjectWithObjectAtIndexInArray (NSMutableArray< T > array, T a, int indexOfB) |
| static String[] | toStringArray (NSArray<?> a) |
| static NSArray | valuesForKeyPaths (Object array, NSArray< String > paths) |
Static Public Attributes | |
| static final String | NULL_GROUPING_KEY = "**** NULL GROUPING KEY ****" |
Static Private Attributes | |
| static final NSDictionary < String, NSSelector > | _selectorsByKey |
| static boolean | initialized = false |
| static Logger | log = Logger.getLogger(ERXArrayUtilities.class) |
| static <T> void addObjectsFromArrayWithoutDuplicates | ( | NSMutableArray< T > | a1, | |
| NSArray<?extends T > | a2 | |||
| ) | [static] |
Adds all of the non-duplicate elements from the second array to the mutable array.
| a1 | mutable array where non-duplicate objects are added | |
| a2 | array to be added to a1 |
| static <T> NSArray<T> arrayByAddingObjectsFromArrayWithoutDuplicates | ( | NSArray<?extends T > | a1, | |
| NSArray<?extends T > | a2 | |||
| ) | [static] |
Creates an array preserving order by adding all of the non-duplicate values from the second array to the first.
| a1 | first array | |
| a2 | second array |
| static <T> NSArray<T> arrayByRemovingFirstObject | ( | NSArray< T > | array | ) | [static] |
Creates an array that has all of the objects of the parameter array without the first object.
| array | the array to use to create the result |
| static <T> NSArray<T> arrayBySelectingInstancesOfClass | ( | final NSArray<?> | array, | |
| final Class< T > | aClass | |||
| ) | [static] |
Prunes an array for only instances of the given class.
| array | array to process | |
| aClass | 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. | static <T> boolean arrayContainsAnyObjectFromArray | ( | NSArray<?extends T > | array, | |
| NSArray<?extends T > | objects | |||
| ) | [static] |
Function to determine if an array contains any of the elements of another array.
| array | to test if it contains any of the objects | |
| objects | array of objects to test if the first array contains any of |
| static <T> boolean arrayContainsArray | ( | NSArray<?extends T > | array, | |
| NSArray<?extends T > | objects | |||
| ) | [static] |
Function to determine if an array contains all of the elements of another array.
| array | to test if it contains all of the objects of another array | |
| objects | array of objects to test if the first array contains all of |
| static NSArray<?> arrayForKeysPath | ( | NSArray<?> | array, | |
| NSArray< String > | keys | |||
| ) | [static] |
Returns an array of dictionaries containing the key/value pairs for the given paths.
| array | array of objects | |
| keys | array of keys |
| static NSArray arrayFromPropertyList | ( | String | name, | |
| NSBundle | bundle | |||
| ) | [static] |
| static NSDictionary arrayGroupedByKeyPath | ( | NSArray | objects, | |
| String | keyPath, | |||
| Object | nullGroupingKey, | |||
| String | valueKeyPath | |||
| ) | [static] |
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. If passed a null array, null is returned. If passed a null keyPath, an empty dictionary is returned. If valueKeyPath is not null, then the grouped arrays each have valueForKey called with valueKeyPath and the grouped arrays are replaced with the results of that call.
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 grouped | |
| keyPath | path into objects used to group the objects | |
| nullGroupingKey | 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. |
| static <T,K,V> NSDictionary<K, NSArray<V> > arrayGroupedByKeyPath | ( | NSArray< T > | objects, | |
| ERXKey< K > | keyPath, | |||
| K | nullGroupingKey, | |||
| ERXKey< V > | valueKeyPath | |||
| ) | [static] |
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. If passed a null array, null is returned. If passed a null keyPath, an empty dictionary is returned. If valueKeyPath is not null, then the grouped arrays each have valueForKey called with valueKeyPath and the grouped arrays are replaced with the results of those calls. This is a typesafe variant of arrayGroupedByKeyPath(NSArray objects, String keyPath, Object nullGroupingKey, String valueKeyPath).
See arrayGroupedByKeyPath(NSArray objects, String keyPath, Object nullGroupingKey, String valueKeyPath) for examples.
| objects | array of objects to be grouped | |
| keyPath | path into objects used to group the objects | |
| nullGroupingKey | 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. |
| static <T,K,V> NSDictionary<K, NSArray<V> > arrayGroupedByKeyPath | ( | NSArray< T > | objects, | |
| String | keyPath, | |||
| boolean | includeNulls, | |||
| String | valueKeyPath | |||
| ) | [static] |
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. If passed a null array, null is returned. If passed a null keyPath, an empty dictionary is returned. If valueKeyPath is not null, then the grouped arrays each have valueForKey called with valueKeyPath and the grouped arrays are replaced with the results of those calls.
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 grouped | |
| keyPath | path into objects used to group the objects | |
| includeNulls | determines if keyPaths that resolve to null are included in the resulting dictionary | |
| 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. |
| static <T,K,V> NSDictionary<K, NSArray<V> > arrayGroupedByKeyPath | ( | NSArray< T > | objects, | |
| ERXKey< K > | keyPath, | |||
| boolean | includeNulls, | |||
| ERXKey< V > | valueKeyPath | |||
| ) | [static] |
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. If passed a null array, null is returned. If passed a null keyPath, an empty dictionary is returned. If valueKeyPath is not null, then the grouped arrays each have valueForKey called with valueKeyPath and the grouped arrays are replaced with the results of those calls. This is a typesafe variant of arrayGroupedByKeyPath(NSArray<T> objects, String keyPath, boolean includeNulls, String valueKeyPath).
See arrayGroupedByKeyPath(NSArray<T> objects, String keyPath, boolean includeNulls, String valueKeyPath) for examples.
| objects | array of objects to be grouped | |
| keyPath | path into objects used to group the objects | |
| includeNulls | determines if keyPaths that resolve to null are included in the resulting dictionary | |
| 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. |
| static <K,V> NSDictionary<K, NSArray<V> > arrayGroupedByKeyPath | ( | NSArray< V > | objects, | |
| String | keyPath | |||
| ) | [static] |
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. If passed a null array, null is returned. If passed a null keyPath, an empty dictionary is returned.
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 grouped | |
| keyPath | path into objects used to group the objects |
| static <K,V> NSDictionary<K, NSArray<V> > arrayGroupedByKeyPath | ( | NSArray< V > | objects, | |
| ERXKey< K > | keyPath | |||
| ) | [static] |
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. If passed a null array, null is returned. If passed a null keyPath, an empty dictionary is returned. This is a typesafe variant of arrayGroupedByKeyPath(NSArray<V> objects, String keyPath).
See arrayGroupedByKeyPath(NSArray<V> objects, String keyPath) for examples.
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 grouped | |
| keyPath | path into objects used to group the objects |
| static NSDictionary arrayGroupedByToManyKeyPath | ( | NSArray | objects, | |
| String | keyPath, | |||
| Object | nullGroupingKey, | |||
| String | valueKeyPath | |||
| ) | [static] |
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. 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 grouped | |
| keyPath | 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 | |
| valueKeyPath | 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 |
| static <T,K,V> NSDictionary<K, NSArray<V> > arrayGroupedByToManyKeyPath | ( | NSArray< T > | objects, | |
| ERXKey< K > | keyPath, | |||
| K | nullGroupingKey, | |||
| ERXKey< V > | valueKeyPath | |||
| ) | [static] |
Typesafe variant of arrayGroupedByToManyKeyPath.
| objects | array of objects to be grouped | |
| keyPath | 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 | |
| valueKeyPath | 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 |
| static <K,V> NSDictionary<K, NSArray<V> > arrayGroupedByToManyKeyPath | ( | NSArray< V > | objects, | |
| String | keyPath, | |||
| K | nullGroupingKey | |||
| ) | [static] |
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. 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 grouped | |
| keyPath | 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 |
| static <K,V> NSDictionary<K, NSArray<V> > arrayGroupedByToManyKeyPath | ( | NSArray< V > | objects, | |
| ERXKey< K > | keyPath, | |||
| K | nullGroupingKey | |||
| ) | [static] |
Typesafe variant of arrayGroupedByToManyKeyPath.
| objects | array of objects to be grouped | |
| keyPath | 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 |
| static <K,V> NSDictionary<K, NSArray<V> > arrayGroupedByToManyKeyPath | ( | NSArray< V > | objects, | |
| String | keyPath, | |||
| boolean | includeNulls | |||
| ) | [static] |
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. A typical example is an array of users with a roles relationship. The result to calling 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 grouped | |
| keyPath | path used to group the objects. | |
| includeNulls | determines if keyPaths that resolve to null should be allowed into the group. |
| static <K,V> NSDictionary<K, NSArray<V> > arrayGroupedByToManyKeyPath | ( | NSArray< V > | objects, | |
| ERXKey< K > | keyPath, | |||
| boolean | includeNulls | |||
| ) | [static] |
Typesafe variant of arrayGroupedByToManyKeyPath.
| objects | the objects to be grouped | |
| keyPath | the key to group by | |
| includeNulls | determins if the keypaths that resolve to null should be allowed in the group |
| static <T> NSArray<T> arrayMinusArray | ( | NSArray< T > | main, | |
| NSArray<?> | minus | |||
| ) | [static] |
Subtracts the contents of one array from another. The order of the array should be preseved.
| main | array to have values removed from it. | |
| minus | array of values to remove from the main array |
| static <T> NSArray<T> arrayMinusObject | ( | NSArray< T > | main, | |
| Object | object | |||
| ) | [static] |
Subtracts a single object from an array.
| main | array to have value removed from it. | |
| object | to be removed |
| static <T> boolean arraysAreIdenticalSets | ( | NSArray<?super T > | a1, | |
| NSArray<?super T > | a2 | |||
| ) | [static] |
Simple comparision method to see if two array objects are identical sets.
| a1 | first array | |
| a2 | second array |
| static <T> NSArray<T> arrayWithObjectsAtIndexesSwapped | ( | final NSArray< T > | array, | |
| final int | indexOfObject1, | |||
| final int | indexOfObject2 | |||
| ) | [static] |
Swaps the two objects at the given indexes in the given NSArray and returns a new NSArray.
| array | in that the two Objects at the given indexes have to be swapped | |
| indexOfObject1 | index of one object in the NSArray that will be swapped | |
| indexOfObject2 | index of the other object in the NSArray that will be swapped |
| {@link | RuntimeException} if one of the indexes is out of bound |
| static <T> NSArray<T> arrayWithObjectsSwapped | ( | final NSArray< T > | array, | |
| final Object | object1, | |||
| final Object | object2 | |||
| ) | [static] |
Swaps the two given Objects in the given NSArray and returns a new NSArray. If one of the Objects is not element of the NSArray a RuntimeException will be thrown.
| <T> | ||
| array | in that the two given Objects have to be swapped | |
| object1 | one object in the NSArray that will be swapped | |
| object2 | the other object in the NSArray that will be swapped |
| static <T> NSArray<T> arrayWithoutDuplicateKeyValue | ( | NSArray< T > | objects, | |
| String | key | |||
| ) | [static] |
Filters out duplicates of an array of objects based on the value of the given key path off of those objects. Objects with a null value will be skipped, too.
| objects | array of objects | |
| key | keypath to be evaluated off of every object |
| static <T> NSArray<T> arrayWithoutDuplicates | ( | NSArray< T > | anArray | ) | [static] |
Filters out all of the duplicate objects in a given array.
Preserves the order now.
| anArray | to be filtered |
| static <T> NSArray<NSArray<T> > batchedArrayWithSize | ( | NSArray< T > | array, | |
| int | batchSize | |||
| ) | [static] |
| static <T> NSSet<T> deepClone | ( | NSSet< T > | set, | |
| boolean | onlyCollections | |||
| ) | [static] |
Returns a deep clone of the given set. A deep clone will attempt to clone the values of this set as well as the set itself.
| set | the set to clone | |
| onlyCollections | if true, only collections in this array will be cloned, not individual values |
| static <T> NSArray<T> deepClone | ( | NSArray< T > | array, | |
| boolean | onlyCollections | |||
| ) | [static] |
Returns a deep clone of the given array. A deep clone will attempt to clone the values of this array as well as the array itself.
| array | the array to clone | |
| onlyCollections | if true, only collections in this array will be cloned, not individual values |
| static <K,T> NSDictionary<K, T> dictionaryOfObjectsIndexedByKeyPath | ( | final NSArray< T > | array, | |
| final String | keyPath | |||
| ) | [static] |
Calls dictionaryOfObjectsIndexedByKeyPathThrowOnCollision() passing false for throwOnCollision.
| static <K,T> NSDictionary<K, T> dictionaryOfObjectsIndexedByKeyPathThrowOnCollision | ( | final NSArray< T > | array, | |
| final String | keyPath, | |||
| final boolean | throwOnCollision | |||
| ) | [static] |
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. This is similar in concept to but different in semantic from 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 index | |
| keyPath | 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. |
| static <T> NSArray<T> distinct | ( | NSArray< T > | array | ) | [static] |
Shorter name for arrayWithoutDuplicates, which I always forget the name of.
| <T> | type of the array | |
| array | the array to return distinct values from |
| static boolean enumerationHasMatchWithQualifierEvaluation | ( | Enumeration<?> | enumeration, | |
| EOQualifierEvaluation | qualifier | |||
| ) | [static] |
Filters any kinds of collections that implements 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 Hashtable | |
| qualifier | to do the filtering |
| static <T> NSArray<T> filteredArrayWithEntityFetchSpecification | ( | NSArray< T > | array, | |
| String | entity, | |||
| String | fetchSpec | |||
| ) | [static] |
Filters a given array with a named fetch specification.
| array | array to be filtered. | |
| fetchSpec | name of the EOQualifierEvaluation. | |
| entity | name of the EOEntity to which the fetch specification is associated. |
| static <T> NSArray<T> filteredArrayWithEntityFetchSpecification | ( | NSArray< T > | array, | |
| String | entity, | |||
| String | fetchSpec, | |||
| NSDictionary< String,?> | bindings | |||
| ) | [static] |
Filters a given array with a named fetch specification and 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. |
| static <T> NSArray<T> filteredArrayWithQualifierEvaluation | ( | Iterator< T > | iterator, | |
| EOQualifierEvaluation | qualifier | |||
| ) | [static] |
Filters any kind of collections that implements 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 collections | |
| qualifier | to do the filtering |
| static <T> NSArray<T> filteredArrayWithQualifierEvaluation | ( | Enumeration< T > | enumeration, | |
| EOQualifierEvaluation | qualifier | |||
| ) | [static] |
Filters any kinds of collections that implements 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 Hashtable | |
| qualifier | to do the filtering |
| static <T> NSArray<T> filteredArrayWithQualifierEvaluation | ( | NSArray< T > | array, | |
| EOQualifierEvaluation | qualifier | |||
| ) | [static] |
Filters an array using the EOQualifierEvaluation interface.
| array | to be filtered | |
| qualifier | to do the filtering |
| static <T> T firstObject | ( | NSArray< T > | array | ) | [static] |
Returns the first object of the array. If the array is null or empty, null is returned.
| array | the array to search. |
| static <T> T firstObjectWithValueForKeyPath | ( | NSArray< T > | array, | |
| Object | value, | |||
| String | keyPath | |||
| ) | [static] |
Finds the first object in the array with a given value for a given key path.
| array | the array to search. | |
| value | the value to look for. | |
| keyPath | the keypath to use to compare to value. |
| static NSArray flatten | ( | NSArray<?> | originalArray | ) | [static] |
Recursively flattens an array of arrays and individual objects into a single array of elements.
For example:
NSArray foos; //Assume exists
NSArray 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 |
| static NSArray flatten | ( | NSArray<?> | originalArray, | |
| boolean | filterDuplicates | |||
| ) | [static] |
Recursively flattens an array of arrays and individual objects into a single array of elements.
For example:
NSArray foos; //Assume exists
NSArray 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 | |
| filterDuplicates | determines if the duplicate values should be filtered |
| static String friendlyDisplayForKeyPath | ( | NSArray<?> | list, | |
| String | attribute, | |||
| String | nullArrayDisplay, | |||
| String | separator, | |||
| String | finalSeparator | |||
| ) | [static] |
Displays a list of attributes off of objects in a 'friendly' manner.
For example, given an array containing three user objects and the attribute key "firstName", the result of calling this method would be the string: "Max, Anjo and Patrice".
| list | of objects to be displayed in a friendly manner | |
| attribute | key to be called on each object in the list | |
| nullArrayDisplay | string to be returned if the list is null or empty | |
| separator | string to be used for the first items | |
| finalSeparator | used between the last items |
| static int indexOfFirstObjectWithValueForKeyPath | ( | NSArray<?> | array, | |
| Object | value, | |||
| String | keyPath | |||
| ) | [static] |
Finds the index of the first object in the array with a given value for a given keypath. Assumes that all objects in the array either are NSKeyValueCoding.NullValue or have the given keypath.
| array | the array to search. | |
| value | the value to look for. | |
| keyPath | the keypath to use to compare to value. |
| static <T> int indexOfObjectUsingEqualator | ( | NSArray< T > | array, | |
| T | object, | |||
| ERXEqualator | equalator | |||
| ) | [static] |
Locates an object within an array using a custom equality check provided as an ERXEqualator. This is useful if you have an array of EOs and want to find a particular EO in it without regard to editing contexts.
| 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. |
| static void initialize | ( | ) | [static] |
Will register new NSArray operators sort, sortAsc, sortDesc, sortInsensitiveAsc, sortInsensitiveDesc, unique, flatten, reverse, limit, and fetchSpec
| static <T> NSArray<T> intersectingElements | ( | NSArray<?extends T > | array1, | |
| NSArray<?extends T > | array2 | |||
| ) | [static] |
Intersects the elements of two arrays. This has the effect of stripping out duplicates.
| array1 | the first array | |
| array2 | the second array |
| static boolean iteratorHasMatchWithQualifierEvaluation | ( | Iterator<?> | iterator, | |
| EOQualifierEvaluation | qualifier | |||
| ) | [static] |
Filters any kinds of collections that implements 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 collections | |
| qualifier | to do the filtering |
Calculates the median value of an array. The median is the value for which half of the elements are above and half the elements are below. As such, an array sort is needed and this might be very costly depending of the size of the array.
| array | array of objects | |
| keypath | key path for the median |
| static String [] objectArrayCastToStringArray | ( | Object[] | o | ) | [static] |
Converts an Object array to a String array by casting each element. This is analogus to String[] myStringArray = (String[])myObjectArray; except that it creates a clone of the array.
| o | an Object array containing String elements |
| static String objectArraysToString | ( | NSArray< Object[][]> | array | ) | [static] |
pretty prints a NSArray of two dimensional Object array which is ugly when using toString
| array | the object which one wants to print as a String |
log.info("my array = "+ERXArrayUtilities.objectArrayToString(myArray)); | static String objectArrayToString | ( | Object | array[][] | ) | [static] |
pretty prints a two dimensional Object array which is ugly when using toString
| array | the object which one wants to print as a String |
log.info("my array = "+ERXArrayUtilities.objectArrayToString(myArray)); | static String objectArrayToString | ( | Object[] | o | ) | [static] |
pretty prints an Object array which is ugly when using toString
| o | the object which one wants to print as a String |
log.info("my array = "+ERXArrayUtilities.objectArrayToString(myArray)); | static <T> NSArray<T> objectsWithValueForKeyPath | ( | final NSArray< T > | array, | |
| final Object | valueToLookFor, | |||
| final String | keyPath | |||
| ) | [static] |
Walks over an array and returns an array of objects from that array that have a particular value for a particular key path. Treats null and NSKeyValueCoding.NullValue equivalently. Any NSKeyValueCoding.NullValue objects in the array are skipped. If array is null or empty, an empty array is returned.
| array | array to search | |
| valueToLookFor | value to look for | |
| keyPath | key path to apply on each object on the array to compare against valueToLookFor |
| static <T> NSArray<T> removeNullValues | ( | NSArray< T > | target, | |
| NSArray< T > | array | |||
| ) | [static] |
Removes all occurencies of NSKeyValueCoding.NullValue in the provided array
| target | array to remove objects from | |
| array | array of values |
| static <T> NSArray<T> removeNullValues | ( | NSArray< T > | array | ) | [static] |
Removes all occurencies of NSKeyValueCoding.NullValue in the provided array
| array | the array from which the NullValue should be removed |
| static <T> NSArray<T> removeNullValuesFromEnd | ( | NSArray< T > | array | ) | [static] |
removes all occurencies of NSKeyValueCoding.Null from the end of the array
| array | the array from which the values should be removed |
| static <T> NSArray<T> reverse | ( | NSArray< T > | array | ) | [static] |
Reverses the elements of an array
| array | to be reversed |
| static <T> void safeAddObject | ( | NSMutableArray< T > | array, | |
| T | object | |||
| ) | [static] |
Adds the object to the mutable array if the object is not null.
| array | mutable array where non-null object will be added | |
| object | to be added to array |
| static <T> NSSet<T> setFromArray | ( | NSArray< T > | array | ) | [static] |
Simply utility method to create a concrete set object from an array.
| array | of elements |
| static <T> void shiftObjectLeft | ( | NSMutableArray< T > | array, | |
| T | object | |||
| ) | [static] |
shifts a given object in an array one value to the left (index--).
| array | array to be modified. | |
| object | the object that should be moved |
| static <T> void shiftObjectRight | ( | NSMutableArray< T > | array, | |
| T | object | |||
| ) | [static] |
shifts a given object in an array one value to the right (index++).
| array | array to be modified. | |
| object | the object that should be moved |
| static void sortArrayWithKey | ( | NSMutableArray<?> | array, | |
| String | key, | |||
| NSSelector | selector | |||
| ) | [static] |
Sorts a given mutable array with a key in place.
| array | array to be sorted. | |
| key | sort key. | |
| selector | sort order selector to use, if null, then sort will be ascending. |
| static void sortArrayWithKey | ( | NSMutableArray<?> | array, | |
| String | key | |||
| ) | [static] |
Sorts a given mutable array with a key in place.
| array | array to be sorted. | |
| key | sort key. |
| static <T> NSArray<T> sortedArraySortedWithKey | ( | NSArray< T > | array, | |
| String | key, | |||
| NSSelector | selector | |||
| ) | [static] |
Sorts a given array with a key in ascending fashion.
| array | array to be sorted. | |
| key | sort key. | |
| selector | sort order selector to use, if null, then sort will be case insensitive ascending. |
| static <T> NSArray<T> sortedArraySortedWithKey | ( | NSArray< T > | array, | |
| String | key | |||
| ) | [static] |
Sorts a given array with a key in ascending fashion.
| array | array to be sorted. | |
| key | sort key. |
| static <T> NSArray<T> sortedArraySortedWithKeys | ( | NSArray< T > | array, | |
| NSArray< String > | keys, | |||
| NSSelector | selector | |||
| ) | [static] |
Sorts a given array with a set of keys according to the given selector.
| array | array to be sorted. | |
| keys | sort keys | |
| selector | sort order selector to use, if null, then sort will be case insensitive ascending. |
| static <T> NSArray<T> sortedArrayUsingComparator | ( | final NSArray< T > | array, | |
| final NSComparator | comparator | |||
| ) | [static] |
Just like the method 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.
| array | ||
| comparator | ||
| <T> |
| static <T> NSMutableArray<T> sortedMutableArraySortedWithKey | ( | NSArray< T > | array, | |
| String | key | |||
| ) | [static] |
Sorts a given array with a key in ascending fashion and returns a mutable clone of the result.
| array | array to be sorted. | |
| key | sort key. |
| static NSSelector sortSelectorWithKey | ( | String | key | ) | [static] |
The qualifiers EOSortOrdering.CompareAscending.. and friends are actually 'special' and processed in a different/faster way when sorting than a selector that would be created by: new NSSelector("compareAscending", ObjectClassArray) This method eases the pain on creating those selectors from a string.
| key | sort key |
Finds the standard deviation of the numeric values found in the array at the specified keypath. If the keypath is null or empty, then the array values are used instead. If the array has fewer than two objects, null is returned. If isPopulation is true, the population standard deviation is calculated. If isPopulation is false, the sample standard deviation is calculated. Use a true value for isPopulation if you know the values for an entire population and false if you are dealing with a sample.
| array | an array of objects | |
| keypath | a key path to a numeric value on each object | |
| isPopulation |
| static <T> void swapObjectsAtIndexesInArray | ( | NSMutableArray< T > | array, | |
| int | indexOfA, | |||
| int | indexOfB | |||
| ) | [static] |
Swaps two objects at the given indexes in an array inplace
| array | the array | |
| indexOfA | - index of the first object | |
| indexOfB | - index of the second object |
| {@link | RuntimeException} if one or both indexes are out of bounds |
| static <T> void swapObjectsInArray | ( | NSMutableArray< T > | array, | |
| T | a, | |||
| T | b | |||
| ) | [static] |
Swaps two objects a and b in an array inplace
| array | the array | |
| a | - first object | |
| b | - second object |
| {@link | RuntimeException} if one or both indexes are out of bounds |
| static <T> void swapObjectWithObjectAtIndexInArray | ( | NSMutableArray< T > | array, | |
| T | a, | |||
| int | indexOfB | |||
| ) | [static] |
Swaps the object a with the object at the given index
| array | the array | |
| a | - first object | |
| indexOfB | - index of second object |
| static String [] toStringArray | ( | NSArray<?> | a | ) | [static] |
| static NSArray valuesForKeyPaths | ( | Object | array, | |
| NSArray< String > | paths | |||
| ) | [static] |
Performs multiple key-value coding calls against an array or an object.
| array | collection or object to be acted upon. | |
| paths | array of keypaths. |
final NSDictionary<String, NSSelector> _selectorsByKey [static, private] |
Initial value:
new NSDictionary<String, NSSelector>(new NSSelector [] { EOSortOrdering.CompareAscending, EOSortOrdering.CompareCaseInsensitiveAscending, EOSortOrdering.CompareCaseInsensitiveDescending, EOSortOrdering.CompareDescending, }, new String [] { "compareAscending", "compareCaseInsensitiveAscending", "compareCaseInsensitiveDescending", "compareDescending", })
boolean initialized = false [static, private] |
caches if array utilities have been initialized
Logger log = Logger.getLogger(ERXArrayUtilities.class) [static, private] |
final String NULL_GROUPING_KEY = "**** NULL GROUPING KEY ****" [static] |
1.5.8