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
class MyInterceptor : Interceptor { | |
override fun intercept(chain: Interceptor.Chain): Response { | |
} | |
} |
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
fun encodeImage(bm: Bitmap): String? { | |
val baos = ByteArrayOutputStream() | |
bm.compress(Bitmap.CompressFormat.JPEG, 100, baos) | |
val b = baos.toByteArray() | |
return Base64.encodeToString(b, Base64.DEFAULT) | |
} | |
fun decodeImage(bm: String, imageView: ImageView,resources: Resources) { | |
val imageBytes = Base64.decode(bm, Base64.DEFAULT) | |
val decodedImage = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size) |
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
fun printUserInfo(name: String, getSurName: (surName: String) -> String = { "" }, age: Int): Unit { | |
} |
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
fun main() { | |
val higherOrderFunction = { surName: String -> "surName : $surName" } | |
val anonymousFunction = fun(surName: String): String { return "surName : $surName" } | |
printUserInfo("EMRE", higherOrderFunction, 20) | |
printUserInfo("EMRE", anonymousFunction, 20) | |
printUserInfo("EMRE", fun(surName: String): String { | |
return "surName : $surName" | |
}, 20) |
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
val anonymousFunction = fun(surName: String): String { return "surName : $surName" } |
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
val higherOrderFunction = { surName: String -> "surName : $surName" } |
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
fun main() { | |
val test = Test() | |
test.main() | |
} | |
class Test { | |
fun main() { | |
3 topla 5 | |
} |
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
fun main() { | |
3 topla 5 | |
} | |
infix fun Int.topla(sayi: Int) { | |
return println(this + sayi)// this =3 , sayi=5 | |
} |
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
fun main() { | |
3.topla(5) | |
} | |
fun Int.topla(sayi: Int) { | |
return println(this + sayi)// this =3 , sayi=5 | |
} |
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
fun main() { | |
val test = Test() | |
test ekranaYaz "selam" | |
} | |
class Test { | |
infix fun ekranaYaz(metin: String) { | |
return print(metin) | |
} | |
} |
NewerOlder