Skip to content

Commit

Permalink
More readability for ERXArrayUtilities.arraysAreIdenticalSets
Browse files Browse the repository at this point in the history
  • Loading branch information
AnhNhan-NUR authored and darkv committed Oct 13, 2015
1 parent b48a669 commit b0596cf
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,25 +483,25 @@ public static NSDictionary arrayGroupedByToManyKeyPath(NSArray objects,
* @return result of comparison
*/
public static <T> boolean arraysAreIdenticalSets(NSArray<? super T> a1, NSArray<? super T> a2) {
if (a1 == null || a2 == null) {
return a1 == a2;
}
boolean result=true;
if (a1 == null || a2 == null) {
return a1 == a2;
}
for (Enumeration<? super T> e=a1.objectEnumerator();e.hasMoreElements();) {
Object i=e.nextElement();
if (!a2.containsObject(i)) {
result=false; break;
return false;
}
}
if (result) {
for (Enumeration<? super T> e=a2.objectEnumerator();e.hasMoreElements();) {
Object i=e.nextElement();
if (!a1.containsObject(i)) {
result=false; break;
}

for (Enumeration<? super T> e=a2.objectEnumerator();e.hasMoreElements();) {
Object i=e.nextElement();
if (!a1.containsObject(i)) {
return false;
}
}
return result;

return true;
}

/**
Expand Down

0 comments on commit b0596cf

Please sign in to comment.