Дан код fun main() { println(listOf(1, 2, 3).asSequence().map { it + 1 }.filter { it.rem(2) == 0 }.joinToString()) } Смотрим в байткод: INVOKESTATIC kotlin/collections/CollectionsKt.asSequence (Ljava/lang/Iterable;)Lkotlin/sequences/Sequence; GETSTATIC some/module/withsome/packages/SequenceKt$main$1.INSTANCE : Lsome/module/withsome/packages/SequenceKt$main$1; CHECKCAST kotlin/jvm/functions/Function1 INVOKESTATIC kotlin/sequences/SequencesKt.map (Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence; GETSTATIC some/module/withsome/packages/SequenceKt$main$2.INSTANCE : Lsome/module/withsome/packages/SequenceKt$main$2; CHECKCAST kotlin/jvm/functions/Function1 INVOKESTATIC kotlin/sequences/SequencesKt.filter (Lkotlin/sequences/Sequence;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence;
Обсуждают сегодня