Skip to content

Commit

Permalink
return constant for empty results
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Aug 19, 2015
1 parent 3c28c19 commit 97dd7f8
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ public static NSDictionary<String, NSArray<EOGlobalID>> globalIDsGroupedByEntity
* @param globalIDs
*/
public static NSArray<Object> primaryKeyValuesWithGlobalIDs(NSArray<EOGlobalID> globalIDs) {
if (globalIDs == null || globalIDs.count() == 0) {
return NSArray.emptyArray();
}
NSMutableArray<Object> result = new NSMutableArray<Object>(globalIDs.count());
NSDictionary<String, NSArray<EOGlobalID>> gidsByEntity = globalIDsGroupedByEntityName(globalIDs);
for (String entityName : gidsByEntity.keySet()) {
Expand All @@ -186,6 +189,9 @@ public static NSArray<Object> primaryKeyValuesWithGlobalIDs(NSArray<EOGlobalID>
* @param values
*/
public static NSArray<EOGlobalID> globalIDsWithPrimaryKeyValues(String entityName, NSArray<Object> values) {
if (values == null || values.count() == 0) {
return NSArray.emptyArray();
}
NSMutableArray<EOGlobalID> result = new NSMutableArray<EOGlobalID>(values.count());
for (Object value : values) {
EOKeyGlobalID gid = EOKeyGlobalID.globalIDWithEntityName(entityName, new Object[] {value});
Expand Down Expand Up @@ -299,6 +305,9 @@ public static NSMutableArray<EOEnterpriseObject> fetchObjectsWithGlobalIDs(EOEdi
* @param prefetchingKeypaths
*/
public static NSArray<EOEnterpriseObject> fireFaultsForGlobalIDs(EOEditingContext ec, NSArray<EOGlobalID> globalIDs, NSArray<String> prefetchingKeypaths) {
if (globalIDs == null || globalIDs.count() == 0) {
return NSArray.emptyArray();
}
NSMutableArray<EOEnterpriseObject> result = new NSMutableArray<EOEnterpriseObject>(globalIDs.count());
NSMutableArray<EOGlobalID> faults = new NSMutableArray<EOGlobalID>(globalIDs.count());
for (EOGlobalID gid : globalIDs) {
Expand Down

0 comments on commit 97dd7f8

Please sign in to comment.