Skip to content

Commit f99dae8

Browse files
authored
Improved Arrays.asList.
1 parent e52186f commit f99dae8

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src.save/test/kotlin/g0301_0400/s0384_shuffle_an_array/SolutionTest.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ package g0301_0400.s0384_shuffle_an_array
33
import org.hamcrest.CoreMatchers.equalTo
44
import org.hamcrest.MatcherAssert.assertThat
55
import org.junit.jupiter.api.Test
6-
import java.util.Arrays
76

87
internal class SolutionTest {
98
@Test
109
fun solutionTest() {
1110
val solution = Solution(intArrayOf(1, 2, 3))
1211
val shuffled = solution.shuffle()
13-
Arrays.sort(shuffled)
12+
shuffled.sort()
1413
assertThat(shuffled, equalTo(intArrayOf(1, 2, 3)))
1514
assertThat(solution.reset(), equalTo(intArrayOf(1, 2, 3)))
1615
}

src/test/kotlin/g0401_0500/s0429_n_ary_tree_level_order_traversal/SolutionTest.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import com_github_leetcode.Node
44
import org.hamcrest.CoreMatchers.equalTo
55
import org.hamcrest.MatcherAssert.assertThat
66
import org.junit.jupiter.api.Test
7-
import java.util.Arrays
87

98
internal class SolutionTest {
109
@Test
@@ -17,9 +16,9 @@ internal class SolutionTest {
1716
node3 = Node(3, listOf(node5, node6))
1817
val root = Node(1, listOf(node3, node2, node4))
1918
val expected: MutableList<List<Int>> = ArrayList()
20-
expected.add(Arrays.asList(1))
21-
expected.add(Arrays.asList(3, 2, 4))
22-
expected.add(Arrays.asList(5, 6))
19+
expected.add(listOf(1))
20+
expected.add(listOf(3, 2, 4))
21+
expected.add(listOf(5, 6))
2322
assertThat(Solution().levelOrder(root).toString(), equalTo(expected.toString()))
2423
}
2524
}

0 commit comments

Comments
 (0)