SlideShare una empresa de Scribd logo
1 de 64
Descargar para leer sin conexión
Statically typed programming language
for the JVM, Android and the browser
100% interoperable with Java™
PaymentRobot payment = new PaymentRobot();
ResultRobot result = payment
.amount(42_00)
.recipient("foo@bar.com")
.send();
result.isSuccess();
val payment = PaymentRobot()
val result = payment
.amount(4200)
.recipient("foo@bar.com")
.send()
result.isSuccess()
val result = payment {
amount(4200)
recipient("foo@bar.com")
}.send()
result.isSuccess()
payment {
amount(4200)
recipient("foo@bar.com")
}.send {
isSuccess()
}
payment {
amount(4200)
recipient("foo@bar.com")
} send {
isSuccess()
}
payment {
amount(4200)
recipient("foo@bar.com")
send()
}
birthday {
date(1970, 1, 1)
next()
}
ssn {
value("123-56-7890")
next()
}
result {
isSuccess()
}
public String foo() {

...

}
// null or non-null?

String f = foo();
@NonNull
public String foo() {

...

}
// non-null

String f = foo();
// nullable

fun nullable(): String? {

...

}



// non-null

fun nonNull(): String {

...

}
// ok

val foo: String? = "foo"



// compile error

val bar: String = null
String foo = "foo";

String bar = "foo";

// isEquals: true
boolean isEquals = foo.equals(bar);
String foo = "foo";

String bar = "foo";



// isEquals: false
boolean isEquals = foo == bar;
val foo = "foo"

val bar = "bar"



// isEquals: true
val isEquals = foo == bar
// MyFunctions.kt



package com.sample.package



fun foo() { }
// OtherFunctions.kt

package com.sample.package.others

// import function foo()

import com.sample.package.foo



fun baz() {

foo()

}
public class MainActivity extends AppCompatActivity {



Button btnCalligraphy;



@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);



btnCalligraphy = (Button) findViewById(R.id.btn_calligraphy);



btnCalligraphy.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

// Do something

}

});



}

}
class MainActivity : AppCompatActivity() {



override fun onCreate(savedInstanceState: Bundle?) {

super.onCreate(savedInstanceState)

setContentView(R.layout.activity_main)



btn_calligraphy.setOnClickListener {

// Do something

}

}

}
view.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View v) {

Toast.makeText(
v.getContext().getApplicationContext(),

"Hello", Toast.LENGTH_SHORT).show();

}

});
view.setOnClickListener({ v ->



Toast.makeText(v.context.applicationContext,

"Hello", Toast.LENGTH_SHORT).show()



})
view.setOnClickListener { v ->



Toast.makeText(v.context.applicationContext,

"Hello", Toast.LENGTH_SHORT).show()



}
view.setOnClickListener {



Toast.makeText(it.context.applicationContext,

"Hello", Toast.LENGTH_SHORT).show()



}
val people : List<String> = ..


people.filter { it.startsWith('S') }

.filter { it.length < 10 }

.onEach { it.toUpperCase() }

.forEach { println(it) }
val people : List<String> = ..


people.filter { it.startsWith('S') }

.filter { it.length < 10 }

.onEach(String::toUpperCase)

.forEach(::println)
val people : List<String> = ..


people.stream()

.filter { it.startsWith('S') }

.filter { it.length < 10 }

.map(String::toUpperCase)

.forEach(::println)
var foo : String = "Foo"

foo = "FOO"



val bar : String = "Bar"

bar = "BAR"
var foo : String = "Foo"

foo = "FOO"



val bar : String = "Bar"

bar = "BAR"
Compile Error (val cannot be reassigned)
val mutableList : MutableList<String>
= mutableListOf(“foo", "bar", "baz")

mutableList.add("fizz")



val immutableList : List<String>
= listOf("foo", "bar", "baz")

immutableList.add("fizz")
val mutableList : MutableList<String>
= mutableListOf("foo", "bar", "baz")

mutableList.add("fizz")



val immutableList : List<String>
= listOf("foo", "bar", "baz")

immutableList.add("fizz")
Compile Error (val cannot be reassigned)
val emptyStringList = listOf<String>()



val cities = listOf("Seoul", "Busan")



val mutableCities = mutableListOf("Seoul, Busan")
val emptyStringSet = setOf<String>()



val cities = setOf("Seoul", "Busan")



val mutableCities = mutableSetOf("Seoul, Busan")
val pair : Pair<String, String> = Pair("Seoul", "서울")
val pair : Pair<String, String> = "Seoul" to "서울"
public class Person {



String name;



String address;



Person(String name, String address) {

this.name = name;

this.address = address;

}



public String getAddress() {

return address;

}



public void setAddress(String address) {

this.address = address;

}

}
public class Person {



String name;



String address;



Person(String name, String address) {

this.name = name;

this.address = address;

}



public String getAddress() {

return address;

}



public void setAddress(String address) {

this.address = address;

}



@Override

public boolean equals(Object o) {

if (this == o) {

return true;

}

if (o == null || getClass() != o.getClass()) {

return false;

}



Person person = (Person) o;



if (!name.equals(person.name)) {

return false;

}

return address != null ? address.equals(person.address) : person.address == null;



}



@Override

public int hashCode() {

int result = name.hashCode();

result = 31 * result + (address != null ? address.hashCode() : 0);

return result;

}



@Override

data class Person(val name: String, val address: String)
Toast.makeText(applicationContext,
"Hello, Kotlin!", Toast.LENGTH_SHORT).show()
// Define an extension function on Context
fun Context.toast(message: String) {

Toast.makeText(this.applicationContext,
message, Toast.LENGTH_SHORT).show()

}
// available in class Context and its descendants
toast("Hello, Kotlin!")
Happy Kotlin!

Más contenido relacionado

La actualidad más candente

The Ring programming language version 1.10 book - Part 52 of 212
The Ring programming language version 1.10 book - Part 52 of 212The Ring programming language version 1.10 book - Part 52 of 212
The Ring programming language version 1.10 book - Part 52 of 212Mahmoud Samir Fayed
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackVic Metcalfe
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland
 
JavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher ChedeauJavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher ChedeauReact London 2017
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1Ke Wei Louis
 
The Ring programming language version 1.3 book - Part 14 of 88
The Ring programming language version 1.3 book - Part 14 of 88The Ring programming language version 1.3 book - Part 14 of 88
The Ring programming language version 1.3 book - Part 14 of 88Mahmoud Samir Fayed
 
Effector: we need to go deeper
Effector: we need to go deeperEffector: we need to go deeper
Effector: we need to go deeperVictor Didenko
 
Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기JangHyuk You
 
The Ring programming language version 1.5.2 book - Part 41 of 181
The Ring programming language version 1.5.2 book - Part 41 of 181The Ring programming language version 1.5.2 book - Part 41 of 181
The Ring programming language version 1.5.2 book - Part 41 of 181Mahmoud Samir Fayed
 
Mongodb Aggregation Pipeline
Mongodb Aggregation PipelineMongodb Aggregation Pipeline
Mongodb Aggregation Pipelinezahid-mian
 
大量地区化解决方案V5
大量地区化解决方案V5大量地区化解决方案V5
大量地区化解决方案V5bqconf
 
Useful javascript
Useful javascriptUseful javascript
Useful javascriptLei Kang
 
HTML5 and CSS3 Refresher
HTML5 and CSS3 RefresherHTML5 and CSS3 Refresher
HTML5 and CSS3 RefresherIvano Malavolta
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)MongoSF
 
Derping With Kotlin
Derping With KotlinDerping With Kotlin
Derping With KotlinRoss Tuck
 
Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018Peter Meyer
 

La actualidad más candente (20)

The Ring programming language version 1.10 book - Part 52 of 212
The Ring programming language version 1.10 book - Part 52 of 212The Ring programming language version 1.10 book - Part 52 of 212
The Ring programming language version 1.10 book - Part 52 of 212
 
ProgrammingwithGOLang
ProgrammingwithGOLangProgrammingwithGOLang
ProgrammingwithGOLang
 
Intro to F#
Intro to F#Intro to F#
Intro to F#
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit Testing
 
JavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher ChedeauJavaScript Code Formatting With Prettier by Christopher Chedeau
JavaScript Code Formatting With Prettier by Christopher Chedeau
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
 
The Ring programming language version 1.3 book - Part 14 of 88
The Ring programming language version 1.3 book - Part 14 of 88The Ring programming language version 1.3 book - Part 14 of 88
The Ring programming language version 1.3 book - Part 14 of 88
 
Effector: we need to go deeper
Effector: we need to go deeperEffector: we need to go deeper
Effector: we need to go deeper
 
Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기Programming Lisp Clojure - 2장 : 클로저 둘러보기
Programming Lisp Clojure - 2장 : 클로저 둘러보기
 
The Ring programming language version 1.5.2 book - Part 41 of 181
The Ring programming language version 1.5.2 book - Part 41 of 181The Ring programming language version 1.5.2 book - Part 41 of 181
The Ring programming language version 1.5.2 book - Part 41 of 181
 
Mongodb Aggregation Pipeline
Mongodb Aggregation PipelineMongodb Aggregation Pipeline
Mongodb Aggregation Pipeline
 
大量地区化解决方案V5
大量地区化解决方案V5大量地区化解决方案V5
大量地区化解决方案V5
 
Useful javascript
Useful javascriptUseful javascript
Useful javascript
 
HTML5 and CSS3 Refresher
HTML5 and CSS3 RefresherHTML5 and CSS3 Refresher
HTML5 and CSS3 Refresher
 
Table through php
Table through phpTable through php
Table through php
 
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
Map/reduce, geospatial indexing, and other cool features (Kristina Chodorow)
 
Derping With Kotlin
Derping With KotlinDerping With Kotlin
Derping With Kotlin
 
Introduction to Go for Java Programmers
Introduction to Go for Java ProgrammersIntroduction to Go for Java Programmers
Introduction to Go for Java Programmers
 
Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018
 

Similar a 레진코믹스가 코틀린으로 간 까닭은?

Kotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
Kotlin Programming Language. What it is all about. Roman Belov, PMM in KotlinKotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
Kotlin Programming Language. What it is all about. Roman Belov, PMM in KotlinJetBrains Russia
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to SwiftGiordano Scalzo
 
Java/Scala Lab: Slava Schmidt - Introduction to Reactive Streams
Java/Scala Lab: Slava Schmidt - Introduction to Reactive StreamsJava/Scala Lab: Slava Schmidt - Introduction to Reactive Streams
Java/Scala Lab: Slava Schmidt - Introduction to Reactive StreamsGeeksLab Odessa
 
Error Handling with the Result Monad
Error Handling with the Result MonadError Handling with the Result Monad
Error Handling with the Result Monadistefo
 
Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2Kirill Rozov
 
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Suyeol Jeon
 
Kotlin : Advanced Tricks - Ubiratan Soares
Kotlin : Advanced Tricks - Ubiratan SoaresKotlin : Advanced Tricks - Ubiratan Soares
Kotlin : Advanced Tricks - Ubiratan SoaresiMasters
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)William Narmontas
 
JavaFX 2.0 With Alternative Languages - JavaOne 2011
JavaFX 2.0 With Alternative Languages - JavaOne 2011JavaFX 2.0 With Alternative Languages - JavaOne 2011
JavaFX 2.0 With Alternative Languages - JavaOne 2011Stephen Chin
 
PHP 7 – What changed internally?
PHP 7 – What changed internally?PHP 7 – What changed internally?
PHP 7 – What changed internally?Nikita Popov
 
かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版Yutaka Kato
 
Introduction to Swift programming language.
Introduction to Swift programming language.Introduction to Swift programming language.
Introduction to Swift programming language.Icalia Labs
 

Similar a 레진코믹스가 코틀린으로 간 까닭은? (17)

Kotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
Kotlin Programming Language. What it is all about. Roman Belov, PMM in KotlinKotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
Kotlin Programming Language. What it is all about. Roman Belov, PMM in Kotlin
 
Miracle of std lib
Miracle of std libMiracle of std lib
Miracle of std lib
 
Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015Pooya Khaloo Presentation on IWMC 2015
Pooya Khaloo Presentation on IWMC 2015
 
A swift introduction to Swift
A swift introduction to SwiftA swift introduction to Swift
A swift introduction to Swift
 
Java/Scala Lab: Slava Schmidt - Introduction to Reactive Streams
Java/Scala Lab: Slava Schmidt - Introduction to Reactive StreamsJava/Scala Lab: Slava Schmidt - Introduction to Reactive Streams
Java/Scala Lab: Slava Schmidt - Introduction to Reactive Streams
 
Error Handling with the Result Monad
Error Handling with the Result MonadError Handling with the Result Monad
Error Handling with the Result Monad
 
Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2Kotlin Basics - Apalon Kotlin Sprint Part 2
Kotlin Basics - Apalon Kotlin Sprint Part 2
 
Kotlin, why?
Kotlin, why?Kotlin, why?
Kotlin, why?
 
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
Swift - 혼자 공부하면 분명히 안할테니까 같이 공부하기
 
Benefits of Kotlin
Benefits of KotlinBenefits of Kotlin
Benefits of Kotlin
 
ddd+scala
ddd+scaladdd+scala
ddd+scala
 
Kotlin : Advanced Tricks - Ubiratan Soares
Kotlin : Advanced Tricks - Ubiratan SoaresKotlin : Advanced Tricks - Ubiratan Soares
Kotlin : Advanced Tricks - Ubiratan Soares
 
An Introduction to Scala (2014)
An Introduction to Scala (2014)An Introduction to Scala (2014)
An Introduction to Scala (2014)
 
JavaFX 2.0 With Alternative Languages - JavaOne 2011
JavaFX 2.0 With Alternative Languages - JavaOne 2011JavaFX 2.0 With Alternative Languages - JavaOne 2011
JavaFX 2.0 With Alternative Languages - JavaOne 2011
 
PHP 7 – What changed internally?
PHP 7 – What changed internally?PHP 7 – What changed internally?
PHP 7 – What changed internally?
 
かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版かとうの Kotlin 講座 こってり版
かとうの Kotlin 講座 こってり版
 
Introduction to Swift programming language.
Introduction to Swift programming language.Introduction to Swift programming language.
Introduction to Swift programming language.
 

Más de Taeho Kim

RxJava in Action
RxJava in ActionRxJava in Action
RxJava in ActionTaeho Kim
 
Android Studio 2.2 - What's new in Android development tools
Android Studio 2.2 - What's new in Android development toolsAndroid Studio 2.2 - What's new in Android development tools
Android Studio 2.2 - What's new in Android development toolsTaeho Kim
 
Multi Window in Android N
Multi Window in Android NMulti Window in Android N
Multi Window in Android NTaeho Kim
 
Material Design with Support Design Library
Material Design with Support Design LibraryMaterial Design with Support Design Library
Material Design with Support Design LibraryTaeho Kim
 
Support Design Library
Support Design LibrarySupport Design Library
Support Design LibraryTaeho Kim
 
Material design for everyone
Material design for everyoneMaterial design for everyone
Material design for everyoneTaeho Kim
 
Notifications for Android L & wear
Notifications for Android L & wearNotifications for Android L & wear
Notifications for Android L & wearTaeho Kim
 
[Hello World 천안아산] 안드로이드 입문
[Hello World 천안아산] 안드로이드 입문[Hello World 천안아산] 안드로이드 입문
[Hello World 천안아산] 안드로이드 입문Taeho Kim
 

Más de Taeho Kim (8)

RxJava in Action
RxJava in ActionRxJava in Action
RxJava in Action
 
Android Studio 2.2 - What's new in Android development tools
Android Studio 2.2 - What's new in Android development toolsAndroid Studio 2.2 - What's new in Android development tools
Android Studio 2.2 - What's new in Android development tools
 
Multi Window in Android N
Multi Window in Android NMulti Window in Android N
Multi Window in Android N
 
Material Design with Support Design Library
Material Design with Support Design LibraryMaterial Design with Support Design Library
Material Design with Support Design Library
 
Support Design Library
Support Design LibrarySupport Design Library
Support Design Library
 
Material design for everyone
Material design for everyoneMaterial design for everyone
Material design for everyone
 
Notifications for Android L & wear
Notifications for Android L & wearNotifications for Android L & wear
Notifications for Android L & wear
 
[Hello World 천안아산] 안드로이드 입문
[Hello World 천안아산] 안드로이드 입문[Hello World 천안아산] 안드로이드 입문
[Hello World 천안아산] 안드로이드 입문
 

Último

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptrcbcrtm
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 

Último (20)

Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.ppt
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 

레진코믹스가 코틀린으로 간 까닭은?

  • 1.
  • 2.
  • 3.
  • 4. Statically typed programming language for the JVM, Android and the browser 100% interoperable with Java™
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. PaymentRobot payment = new PaymentRobot(); ResultRobot result = payment .amount(42_00) .recipient("foo@bar.com") .send(); result.isSuccess();
  • 13. val payment = PaymentRobot() val result = payment .amount(4200) .recipient("foo@bar.com") .send() result.isSuccess()
  • 14. val result = payment { amount(4200) recipient("foo@bar.com") }.send() result.isSuccess()
  • 17. payment { amount(4200) recipient("foo@bar.com") send() } birthday { date(1970, 1, 1) next() } ssn { value("123-56-7890") next() } result { isSuccess() }
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. public String foo() {
 ...
 } // null or non-null?
 String f = foo();
  • 25. @NonNull public String foo() {
 ...
 } // non-null
 String f = foo();
  • 26. // nullable
 fun nullable(): String? {
 ...
 }
 
 // non-null
 fun nonNull(): String {
 ...
 }
  • 27. // ok
 val foo: String? = "foo"
 
 // compile error
 val bar: String = null
  • 28. String foo = "foo";
 String bar = "foo";
 // isEquals: true boolean isEquals = foo.equals(bar);
  • 29. String foo = "foo";
 String bar = "foo";
 
 // isEquals: false boolean isEquals = foo == bar;
  • 30. val foo = "foo"
 val bar = "bar"
 
 // isEquals: true val isEquals = foo == bar
  • 31.
  • 33. // OtherFunctions.kt
 package com.sample.package.others
 // import function foo()
 import com.sample.package.foo
 
 fun baz() {
 foo()
 }
  • 34.
  • 35.
  • 36. public class MainActivity extends AppCompatActivity {
 
 Button btnCalligraphy;
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 
 btnCalligraphy = (Button) findViewById(R.id.btn_calligraphy);
 
 btnCalligraphy.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View view) {
 // Do something
 }
 });
 
 }
 }
  • 37. class MainActivity : AppCompatActivity() {
 
 override fun onCreate(savedInstanceState: Bundle?) {
 super.onCreate(savedInstanceState)
 setContentView(R.layout.activity_main)
 
 btn_calligraphy.setOnClickListener {
 // Do something
 }
 }
 }
  • 38. view.setOnClickListener(new View.OnClickListener() {
 @Override
 public void onClick(View v) {
 Toast.makeText( v.getContext().getApplicationContext(),
 "Hello", Toast.LENGTH_SHORT).show();
 }
 });
  • 40. view.setOnClickListener { v ->
 
 Toast.makeText(v.context.applicationContext,
 "Hello", Toast.LENGTH_SHORT).show()
 
 }
  • 42. val people : List<String> = .. 
 people.filter { it.startsWith('S') }
 .filter { it.length < 10 }
 .onEach { it.toUpperCase() }
 .forEach { println(it) }
  • 43. val people : List<String> = .. 
 people.filter { it.startsWith('S') }
 .filter { it.length < 10 }
 .onEach(String::toUpperCase)
 .forEach(::println)
  • 44. val people : List<String> = .. 
 people.stream()
 .filter { it.startsWith('S') }
 .filter { it.length < 10 }
 .map(String::toUpperCase)
 .forEach(::println)
  • 45. var foo : String = "Foo"
 foo = "FOO"
 
 val bar : String = "Bar"
 bar = "BAR"
  • 46. var foo : String = "Foo"
 foo = "FOO"
 
 val bar : String = "Bar"
 bar = "BAR" Compile Error (val cannot be reassigned)
  • 47. val mutableList : MutableList<String> = mutableListOf(“foo", "bar", "baz")
 mutableList.add("fizz")
 
 val immutableList : List<String> = listOf("foo", "bar", "baz")
 immutableList.add("fizz")
  • 48. val mutableList : MutableList<String> = mutableListOf("foo", "bar", "baz")
 mutableList.add("fizz")
 
 val immutableList : List<String> = listOf("foo", "bar", "baz")
 immutableList.add("fizz") Compile Error (val cannot be reassigned)
  • 49.
  • 50.
  • 51. val emptyStringList = listOf<String>()
 
 val cities = listOf("Seoul", "Busan")
 
 val mutableCities = mutableListOf("Seoul, Busan")
  • 52. val emptyStringSet = setOf<String>()
 
 val cities = setOf("Seoul", "Busan")
 
 val mutableCities = mutableSetOf("Seoul, Busan")
  • 53. val pair : Pair<String, String> = Pair("Seoul", "서울")
  • 54. val pair : Pair<String, String> = "Seoul" to "서울"
  • 55. public class Person {
 
 String name;
 
 String address;
 
 Person(String name, String address) {
 this.name = name;
 this.address = address;
 }
 
 public String getAddress() {
 return address;
 }
 
 public void setAddress(String address) {
 this.address = address;
 }
 }
  • 56. public class Person {
 
 String name;
 
 String address;
 
 Person(String name, String address) {
 this.name = name;
 this.address = address;
 }
 
 public String getAddress() {
 return address;
 }
 
 public void setAddress(String address) {
 this.address = address;
 }
 
 @Override
 public boolean equals(Object o) {
 if (this == o) {
 return true;
 }
 if (o == null || getClass() != o.getClass()) {
 return false;
 }
 
 Person person = (Person) o;
 
 if (!name.equals(person.name)) {
 return false;
 }
 return address != null ? address.equals(person.address) : person.address == null;
 
 }
 
 @Override
 public int hashCode() {
 int result = name.hashCode();
 result = 31 * result + (address != null ? address.hashCode() : 0);
 return result;
 }
 
 @Override

  • 57. data class Person(val name: String, val address: String)
  • 59. // Define an extension function on Context fun Context.toast(message: String) {
 Toast.makeText(this.applicationContext, message, Toast.LENGTH_SHORT).show()
 } // available in class Context and its descendants toast("Hello, Kotlin!")
  • 60.
  • 61.
  • 62.
  • 63.