diff --git a/libraries/stdlib/samples/test/samples/collections/collections.kt b/libraries/stdlib/samples/test/samples/collections/collections.kt index cfffedb06b7..c7654bbbb28 100644 --- a/libraries/stdlib/samples/test/samples/collections/collections.kt +++ b/libraries/stdlib/samples/test/samples/collections/collections.kt @@ -371,14 +371,17 @@ class Collections { val evens = zeroToTen.map { it * 2 } assertTrue(evens.all { isEven(it) }) - assertTrue(emptyList().all { false }) + val emptyList = emptyList() + assertTrue(emptyList.all { false }) } @Sample fun none() { - assertTrue(emptyList().none()) + val emptyList = emptyList() + assertTrue(emptyList.none()) - assertFalse(listOf("one", "two", "three").none()) + val nonEmptyList = listOf("one", "two", "three") + assertFalse(nonEmptyList.none()) } @Sample @@ -391,14 +394,17 @@ class Collections { val odds = zeroToTen.map { it * 2 + 1 } assertTrue(odds.none { isEven(it) }) - assertTrue(emptyList().none { true }) + val emptyList = emptyList() + assertTrue(emptyList.none { true }) } @Sample fun any() { - assertFalse(emptyList().any()) + val emptyList = emptyList() + assertFalse(emptyList.any()) - assertTrue(listOf(1, 2, 3).any()) + val nonEmptyList = listOf(1, 2, 3) + assertTrue(nonEmptyList.any()) } @Sample @@ -411,7 +417,8 @@ class Collections { val odds = zeroToTen.map { it * 2 + 1 } assertFalse(odds.any { isEven(it) }) - assertFalse(emptyList().any { true }) + val emptyList = emptyList() + assertFalse(emptyList.any { true }) } }