Last active
December 5, 2017 19:48
-
-
Save bes89/6fd9c52d94a6bedafddd9845a3e6df80 to your computer and use it in GitHub Desktop.
job posting for a start-up looking for an android/kotlin dev
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data class Skill(val description: String) | |
interface AwesomeGuy | |
interface AndroidGeek | |
interface TeamPlayer | |
object MateCrate { | |
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() { | |
MateCrate.let { | |
it.beAwesome { | |
you?.apply { | |
to(MateCrate) | |
when { | |
skills.isNotEmpty() && | |
this is TeamPlayer && | |
this is AwesomeGuy -> { | |
MateCrate.members.add(you) | |
with(you as AndroidGeek) { | |
it.wilBeEvenMoreAwesome() | |
fun yeah() {} | |
also { | |
you.benefits.addAll(MateCrate.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