June 2018
Intermediate to advanced
316 pages
6h 34m
English
The _Ranges.kt file contains many utility functions for the IntProgression, LongProgression, and CharProgression classes. For instance, the reversed() function:
public fun IntProgression.reversed(): IntProgression { return IntProgression.fromClosedRange(last, first, -step)}public fun LongProgression.reversed(): LongProgression { return LongProgression.fromClosedRange(last, first, -step)}public fun CharProgression.reversed(): CharProgression { return CharProgression.fromClosedRange(last, first, -step)}
One use of this function might look as follows:
fun main(args: Array<String>) { val value = args[0].toInt() if (value in (0..10).reversed()) { println(value) }}
Decompiled to Java, it looks like this:
public final class Read now
Unlock full access