Skip to content

Commit

Permalink
kotlin annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
jclemus91 committed Jul 17, 2019
1 parent 944198b commit 4a6fde6
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions temario_training.todo
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,54 @@ son coparadas con equals, deberian tener el mismo hashCode
COPY()
reusa los valores de una instancia existente, permite crear nuevas instancias
y overridear los paramatros que queremos remplezar
ENUM
interface Exotic{
fun isExotic() : Boolean
}
enum class Flour: Exotic {
CASSAVA {
override fun isGlutenFree() : Boolean {
return true
}
override fun isExotic() : Boolean {
return true
}
}
abstract fun isGlutenFree() : Boolean
}
GENERICS Y FUNCTIONES AS PARAMETERS
fun main() {
println(transform("kotlin", ::reverse))
println(transform("java", { reverse(it) }))
println(transform("java") { reverse(it) })
unless(false) {
println("si entra")
}
println(a())
}

fun <T> transform(t: T, fn: (T) -> T): T {
return fn(t)
}

fun reverse(string: String): String {
return string.reversed()
}

fun unless(condition: Boolean, block: () -> Unit) {
if (!condition) block.invoke()
}

fun a() :String {
fun b() : String {
fun c() : String {
return "c"
}
return "b ${c()}"
}
return "a ${b()}"
}

1er hora
Vista Simple con Texto al centro
DI
Expand Down

0 comments on commit 4a6fde6

Please sign in to comment.