목록전체 글 (134)
Foggy day
val items: PublishSubject = PublishSubject.create() items.onNext(1) items.onNext(2) items.onNext(3) items.filter { i -> i % 2 == 0 }.subscribe(::println) items.onNext(4) items.onNext(5) items.onNext(6) items.onNext(7) items.onNext(8)
class KotlinPlayGroundActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_kotlin_play_ground) val lists = listOf('a', 'f', 'd', 'w') println("toString : ${toString(lists)}") println("add : ${add(10, 15)}") println("addSecond : ${addSecond(10, 15)}") println("factorialFirst : ${Factorial.factoria..
class KotlinPlayGroundActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_kotlin_play_ground) val lists = listOf('a', 'b', 'c', 'd', 'e') println("toString : ${toString(lists, "text")}") println("toStringSecond : ${toStringSecond(lists, "text")}") println("toStringThird : ${toStringThird(lists, ..
class KotlinPlayGroundActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_kotlin_play_ground) val toothPaste = Product("ToothPast", Price(2.0), Weight(3.1)) val toothBrush = Product("ToothBrush", Price(3.0), Weight(2.5)) val orderLines = listOf( OrderLine(toothPaste, 3), OrderLine(toothBrush, 5)..
class KotlinPlayGroundActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_kotlin_play_ground) val a = "A" val b = "B" val c = "C" val d = "D" println("func : ${func(a, b, c, d)}") println("curriedFunc : ${curriedFunc()(b)(c)(d)(a)}") println("curriedString : ${curriedString(a)(b)(c)(d)}") } fun ..
It is necessary to seperate the use of 'getSupportFragmentManager()' and 'getChildFragmentManager()'. If you have Activity "A" and Fragment "A-1" in "A", you should use getSupportFragmentManager() when you manage "A-1". getSupportFragmentManager() need activity. But If you have Fragment "B", "C" in "A-1", you shoud use getChildFragmentManager() when you manage "B", "C". If you work in fragment "..
class KotlinPlayGroundActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_kotlin_play_ground) val result = compose(::divide, ::multiply) println("result : ${result(3)}") val result2 = compose2(::divide, ::multiply) println("result2 : ${result2(4)}") val result3 = compose3(::divide, ::multiply) p..
class KotlinPlayGroundActivity : AppCompatActivity() { val x = 5 val y = 7 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_kotlin_play_ground) println("jhFun_1 : ${jhFun_1(x)}") println("jhFun_2 : ${jhFun_2(x)}") println("jhFun_3 : ${jhFun_3(x)}") println("jhFun_4 : ${jhFun_4(x, y)}") println("jhFun_5 : ${jhFun_5(x)}") prin..
If you want to display multiple lines, you can use triple quotes(""") and trimMargin(). println("""Example of Jinhan : It is about String |First line |Second line |Third line |Fourth line """.trimMargin())
class KotlinPlayGroundActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_kotlin_play_ground) val message = "It is test" val length: Int = if (message is String) message.length else 100 println("length : $length") val value: Int = when (message) { is String -> message.length else -> 100 } printl..