Hullaballoonatic
04/10/2019, 5:52 PMoperator fun List<Int>.get(range: IntRange) = subList(range.start, range.endInclusive - 1)
val foo = listOf(1,2,3,4)
val bar = foo[0..2] // [1,2,3]
But I think foo[1..]
and foo[..3]
would be great too, even though you can accomplish them each with a single list method, this looks nicer imo
That would require the rangeTo
operator to create unbounded ranges, though, but I think it'd be nice to have that, too.
Thoughts?