Revert 'isEmpty' transformation
This commit is contained in:
committed by
Mikhail Glukhikh
parent
17c906658d
commit
6322198a11
@@ -13,7 +13,7 @@ public interface Comparator<T> {
|
||||
|
||||
@library
|
||||
public abstract class AbstractCollection<E>() : MutableCollection<E> {
|
||||
override val isEmpty: Boolean get() = noImpl
|
||||
override fun isEmpty(): Boolean = noImpl
|
||||
override fun contains(o: E): Boolean = noImpl
|
||||
override fun iterator(): MutableIterator<E> = noImpl
|
||||
|
||||
@@ -103,7 +103,7 @@ public open class LinkedHashSet<E>(
|
||||
@library
|
||||
public open class HashMap<K, V>(initialCapacity: Int = DEFAULT_INITIAL_CAPACITY, loadFactor: Float = DEFAULT_LOAD_FACTOR) : MutableMap<K, V> {
|
||||
override val size: Int get() = noImpl
|
||||
override val isEmpty: Boolean get() = noImpl
|
||||
override fun isEmpty(): Boolean = noImpl
|
||||
@Suppress("BASE_WITH_NULLABLE_UPPER_BOUND")
|
||||
override fun get(key: K): V? = noImpl
|
||||
override fun containsKey(key: K): Boolean = noImpl
|
||||
|
||||
@@ -178,7 +178,7 @@ private fun RegExp.findNext(input: String, from: Int): MatchResult? {
|
||||
|
||||
override val groups: MatchGroupCollection = object : MatchGroupCollection {
|
||||
override val size: Int get() = match.size()
|
||||
override val isEmpty: Boolean get() = size() == 0
|
||||
override fun isEmpty(): Boolean = size() == 0
|
||||
|
||||
override fun contains(o: MatchGroup?): Boolean = this.any { it == o }
|
||||
override fun containsAll(c: Collection<MatchGroup?>): Boolean = c.all({contains(it)})
|
||||
|
||||
@@ -5,5 +5,5 @@ import java.util.ArrayList;
|
||||
fun box(): Boolean {
|
||||
val a = ArrayList<Int>();
|
||||
a.add(3)
|
||||
return !(a.isEmpty) && (ArrayList<Int>().isEmpty);
|
||||
return !(a.isEmpty()) && (ArrayList<Int>().isEmpty());
|
||||
}
|
||||
+2
-2
@@ -28,7 +28,7 @@ fun box(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
if (a.isEmpty || !ArrayList<Int>().isEmpty) {
|
||||
if (a.isEmpty() || !ArrayList<Int>().isEmpty()) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ fun box(): Boolean {
|
||||
assertEquals(a, b, "a == b")
|
||||
|
||||
a.clear()
|
||||
assertEquals(true, a.isEmpty, "a.isEmpty")
|
||||
assertEquals(true, a.isEmpty(), "a.isEmpty()")
|
||||
|
||||
|
||||
assertEquals(arrayOf(1, 500, 2, 3), list.toTypedArray(), "list.toTypedArray()")
|
||||
|
||||
+3
-5
@@ -398,10 +398,8 @@
|
||||
}
|
||||
return true;
|
||||
},
|
||||
isEmpty: {
|
||||
get: function () {
|
||||
return this.size === 0;
|
||||
}
|
||||
isEmpty: function () {
|
||||
return this.size === 0;
|
||||
},
|
||||
iterator: function () {
|
||||
// TODO: Do not implement mutable iterator() this way, make abstract
|
||||
@@ -972,7 +970,7 @@
|
||||
});
|
||||
|
||||
Kotlin.collectionsMax = function (c, comp) {
|
||||
if (c.isEmpty) {
|
||||
if (c.isEmpty()) {
|
||||
//TODO: which exception?
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
Vendored
+11
-17
@@ -347,11 +347,9 @@
|
||||
bucketsByHash = {};
|
||||
};
|
||||
|
||||
Object.defineProperty(this, "isEmpty", {
|
||||
get: function () {
|
||||
return !buckets.length;
|
||||
}
|
||||
});
|
||||
this.isEmpty = function () {
|
||||
return !buckets.length;
|
||||
};
|
||||
|
||||
var createBucketAggregator = function (bucketFuncName) {
|
||||
return function () {
|
||||
@@ -574,10 +572,8 @@
|
||||
iterator: function () {
|
||||
return new Kotlin.PrimitiveHashMapValuesIterator(this.map.map, Object.keys(this.map.map));
|
||||
},
|
||||
isEmpty: {
|
||||
get: function () {
|
||||
return this.map.isEmpty;
|
||||
}
|
||||
isEmpty: function () {
|
||||
return this.map.isEmpty();
|
||||
},
|
||||
size: {
|
||||
get: function () {
|
||||
@@ -608,10 +604,8 @@
|
||||
return this.$size;
|
||||
}
|
||||
},
|
||||
isEmpty: {
|
||||
get: function () {
|
||||
return this.$size === 0;
|
||||
}
|
||||
isEmpty: function () {
|
||||
return this.$size === 0;
|
||||
},
|
||||
containsKey_za3rmp$: function (key) {
|
||||
// TODO: should process "__proto__" separately?
|
||||
@@ -691,7 +685,7 @@
|
||||
return this.map;
|
||||
},
|
||||
toString: function() {
|
||||
if (this.isEmpty) return "{}";
|
||||
if (this.isEmpty()) return "{}";
|
||||
var map = this.map;
|
||||
var isFirst = true;
|
||||
var builder = "{";
|
||||
@@ -1067,9 +1061,9 @@
|
||||
return hashTable.size;
|
||||
}});
|
||||
|
||||
Object.defineProperty(this, "isEmpty", { get: function () {
|
||||
return hashTable.isEmpty;
|
||||
}});
|
||||
this.isEmpty = function () {
|
||||
return hashTable.isEmpty();
|
||||
};
|
||||
|
||||
this.clone = function () {
|
||||
var h = new HashSet(hashingFunction, equalityFunction);
|
||||
|
||||
@@ -11,7 +11,7 @@ fun box(): String {
|
||||
assertTrue((stdlib_emptyListClass() as Any) is List<*>, "stdlib_emptyListClass() is List<*> #2")
|
||||
assertTrue((stdlib_emptyListClass() as Any) !is ArrayList<*>, "stdlib_emptyListClass() !is ArrayList<*>")
|
||||
|
||||
assertTrue(stdlib_emptyListClass().isEmpty, "stdlib_emptyListClass().isEmpty")
|
||||
assertTrue(stdlib_emptyListClass().isEmpty(), "stdlib_emptyListClass().isEmpty()")
|
||||
assertTrue(stdlib_emptyListClass().size() == 0, "stdlib_emptyListClass().size() == 0")
|
||||
|
||||
return "OK"
|
||||
|
||||
Reference in New Issue
Block a user