diff --git a/src/as/com/threerings/util/ArrayUtil.as b/src/as/com/threerings/util/ArrayUtil.as index 70161f66d..b6335644e 100644 --- a/src/as/com/threerings/util/ArrayUtil.as +++ b/src/as/com/threerings/util/ArrayUtil.as @@ -107,6 +107,26 @@ public class ArrayUtil return removeImpl(arr, element, false); } + /** + * Do the two arrays contain elements that are all equals()? + */ + public static function equals (ar1 :Array, ar2 :Array) :Boolean + { + if (ar1 === ar2) { + return true; + + } else if (ar1 == null || ar2 == null || ar1.length != ar2.length) { + return false; + } + + for (var jj :int = 0; jj < ar1.length; jj++) { + if (!Util.equals(ar1[jj], ar2[jj])) { + return false; + } + } + return true; + } + /** * Implementation of remove methods. */ diff --git a/src/as/com/threerings/util/Util.as b/src/as/com/threerings/util/Util.as index 221773396..e11cf9f99 100644 --- a/src/as/com/threerings/util/Util.as +++ b/src/as/com/threerings/util/Util.as @@ -64,17 +64,7 @@ public class Util return (obj1 as Equalable).equals(obj2); } else if ((obj1 is Array) && (obj2 is Array)) { - var ar1 :Array = (obj1 as Array); - var ar2 :Array = (obj2 as Array); - if (ar1.length != ar2.length) { - return false; - } - for (var jj :int = 0; jj < ar1.length; jj++) { - if (!equals(ar1[jj], ar2[jj])) { - return false; - } - } - return true; + return ArrayUtil.equals(obj1 as Array, obj2 as Array); } else if ((obj1 is ByteArray) && (obj2 is ByteArray)) { var ba1 :ByteArray = (obj1 as ByteArray);