Skip to content

Instantly share code, notes, and snippets.

@williamokano
Last active March 12, 2019 04:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save williamokano/e27b59dc5671118a9b8cfa65f5bb5f46 to your computer and use it in GitHub Desktop.
data class Funcionario(
val nome: String,
val salario: Int, // Aqui vamos apenas supor que ele ganhe valores sem quebra para facilitar
val numeroFilhos: Int = 0
)
fun main(args: Array<String>) {
val funcionarios = listOf(Funcionario("William", 999, 2))
funcionarios.filter { it.salario < 1000 }
.map { it.nome to it.salario + it.numeroFilhos * 100 }
.forEach { println("${it.first} irá receber ${it.second}") }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment