fun T?.ifPresent(compute: (T) -> Unit): T? { if (this != null) compute(this!!) return this } ----------- interests.getInterestById(tag).ifPresent { tagView -> if (somecondition) return@ifPresent methodWhichReturnsNullable }