[K/N] ArrayList.ensureCapacity() should ignore negative arguments

This commit is contained in:
Abduqodiri Qurbonzoda
2023-05-31 00:21:40 +03:00
committed by Space Team
parent ae394caf42
commit 89d1cfe05b
3 changed files with 25 additions and 16 deletions
@@ -1256,4 +1256,9 @@ class CollectionTest {
val arr2: Array<String> = coll.toArray(Array(coll.size + 1) { "" })
assertEquals(data + listOf(null), arr2.asList())
}
@Test
fun ensureCapacity() {
ArrayList<String>().ensureCapacity(-1) // negative argument is ignored
}
}