假设我有一个类似的数组1 2 3 4 5,我想将它向左旋转n并得到一个新的数组。
例如,上述数组的2旋转将导致3 4 5 1 2。我没有找到任何扩展功能来做到这一点。
我尝试将我的用例类从 Java 切换到 Kotlin,从 Rxjava 切换到协程。
这是我的GetTopSongs课。
class GetTopSongs {
suspend fun execute(limit:Int):Either<List<Song>>{
//... do stuff
}
}
Run Code Online (Sandbox Code Playgroud)
我想知道是否有比getTopSongs.execute(10)Kotlin更好的方法?