Skip to content

Instantly share code, notes, and snippets.

@bes89
Created December 5, 2017 19:37
Show Gist options
  • Save bes89/cd9c02ebc1609b0b84314b3c9b3242f9 to your computer and use it in GitHub Desktop.
Save bes89/cd9c02ebc1609b0b84314b3c9b3242f9 to your computer and use it in GitHub Desktop.
job posting for a start-up looking for an android/kotlin dev
data class Skill(val description: String)
interface AwesomeGuy
interface AndroidGeek
interface TeamPlayer
object MateCrte {
val skills = mutableListOf<Skill>()
val members = mutableListOf<AwesomeGuy>()
val benefits = mutableListOf<String>()
fun beAwesome(andDoThis: () -> Unit) = andDoThis()
fun wilBeEvenMoreAwesome() = true
}
data class Person(val skills: Set<Skill>, val benefits: MutableList<String> = mutableListOf()) :
AwesomeGuy, TeamPlayer, AndroidGeek
val you: Person? = Person(setOf(Skill("..."), Skill("...")))
val bigBang = fun() {
MateCrte.let {
it.beAwesome {
you?.apply {
to(MateCrte)
when {
skills.isNotEmpty() &&
this is TeamPlayer &&
this is AwesomeGuy -> {
MateCrte.members.add(you)
with(you as AndroidGeek) {
it.wilBeEvenMoreAwesome()
fun yeah() {}
also {
you.benefits.addAll(MateCrte.benefits)
}
}
}
else -> run { print("sry") }
}
} ?: print("NPE caught")
}
}
}.invoke()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment