Hey I have list of int type for example. I want to pass startingIndex and endingIndex to get between items of that range in list. So How can I do this in efficient way in Kotlin.
val list = mutableListOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
For example
Scenario 1
startingIndex = 2
, endingIndex = 6
List will returns items
Expected Output
3, 4, 5, 6, 7
Scenario 2
startingIndex = 0
, endingIndex = 2
List will returns items
1, 2, 3
Thanks in advance.