JS stdlib: fixed Set::equals.

This commit is contained in:
Zalim Bashorov
2014-12-23 19:28:25 +03:00
parent 217e25855e
commit 7579471859
2 changed files with 24 additions and 23 deletions
+9 -21
View File
@@ -46,6 +46,12 @@
}
}
function hashSetEquals(o) {
if (o === null || o === undefined || this.size() !== o.size()) return false;
return this.containsAll_4fm7v2$(o);
}
/** @const */
var FUNCTION = "function";
var arrayRemoveAt = (typeof Array.prototype.splice == FUNCTION) ?
@@ -686,6 +692,7 @@
},
/** @lends {Kotlin.LinkedHashSet.prototype} */
{
equals_za3rmp$: hashSetEquals,
size: function () {
return this.map.size()
},
@@ -753,6 +760,7 @@
},
/** @lends {Kotlin.AbstractPrimitiveHashSet.prototype} */
{
equals_za3rmp$: hashSetEquals,
size: function () {
return this.$size;
},
@@ -898,27 +906,7 @@
return h;
};
this.equals_za3rmp$ = function (o) {
if (o === null || o === undefined) return false;
if (this.size() === o.size()) {
var iter1 = this.iterator();
var iter2 = o.iterator();
while (true) {
var hn1 = iter1.hasNext();
var hn2 = iter2.hasNext();
if (hn1 != hn2) return false;
if (!hn2) {
return true;
}
else {
var o1 = iter1.next();
var o2 = iter2.next();
if (!Kotlin.equals(o1, o2)) return false;
}
}
}
return false;
};
this.equals_za3rmp$ = hashSetEquals;
this.toString = function () {
var builder = "[";