본문 바로가기
[도서 목차 정리] Kotlin in action [도서 목차 정리] Kotlin in action Kotlin in action 을 공부하면서 정리한 내용입니다.Java 를 어느 정도 이해하고 숙달한 사람들이 이해하기 좋습니다.Java 와 동일하거나 너무 당연한 기본적인 내용은 정리하지 않았습니다. Kotlin 소개 - Kotlin : what and why Kotlin 기초 #1 - Chap2. Kotlin basics Kotlin 기초 #2 - Chap2. Kotlin basics 함수 정의하고 호출하기 #1 - Chap 3. Defining and calling functions 함수 정의하고 호출하기 #2 클래스, objects, 그리고 인터페이스 #1 - Chap4. Classes, objects, and interfaces 클래스, obje.. 2017. 9. 25.
[Kotlin Tutorial] Operator overload 와 convention #1 - Chap7. Operator overloading and other conventions [Kotlin Tutorial] Operator overload 와 convention #1 - Chap7. Operator overloading and other conventions 참조 : Kotlin in action -Java 에는 특정 class 에 결속되어 있는 언어적 기능이 있다.예를 들어 Iterable 를 구현하면 for loop 에서 쓸 수 있고, AutoCloseable 을 구현하면 try-with-resources 에서 사용할 수 있다. Kotlin 도 비슷한 것들이 있다.그러나 specific type 에 결속된 것이 아니라 specific name 에 결속되는 기능들이 있다.예를 들어 plus 라는 이름으로 class 에 function 을 추가하면, + operator 를 해.. 2017. 8. 24.
[Kotlin Tutorial] 람다로 프로그래밍 하기 - Chap5. Programming with Lambdas [Kotlin Tutorial] 람다로 프로그래밍 하기 - Chap5. Programming with Lambdas 참조 : Kotlin in Action 5.1. Lambda expressions and member references 5.1.1. Introduction to lambdas : blocks of code as function parameters 5.1.2. Lambdas and collections -val people = listOf(Person(“Alice”, 29), Person(“Bob”, 31))println( people.maxBy{ it.age } ) // function 을 argument 로 받는다. { } 는 lambda syntax lambda 가 단순 functio.. 2017. 8. 16.
[Kotlin Tutorial] 클래스, objects, 그리고 인터페이스 #2 [Kotlin Tutorial] 클래스, objects, 그리고 인터페이스 #2 참조 : Kotlin in Action 4.3. Compiler-generated methods: Data classes and Class delegation 4.3.1. Universal object methods -Java 에서 == 는 primitive 나 object 의 reference 를 비교하는 것.Kotlin 에서는 == 가 기본비교이다. equals 를 호출해서 비교한다.그럼 Java 에서의 == 는? === 로 대체된다. 4.3.2. Data classes: autogenerated implementations of universal methods -data class Client(val name: Stri.. 2017. 8. 14.
[Kotlin Tutorial] 함수 정의하고 호출하기 #2 [Kotlin Tutorial] 함수 정의하고 호출하기 #2 참조 : Kotlin in Action 3.4. Working with collections: Varargs, Infix calls, and Library support 3.4.1. Extending the Java collections API -val strings: List = listOf(“first”, “second”, “thrid”)strings.last() val numbers: Collection = setOf(1, 14, 2)numbers.max() last 와 max 는 extension 이다.이 외에도 많이 있으니 IDE 의 code completion 을 잘 활용해보시라~ 3.4.2. Varargs: functions tha.. 2017. 8. 3.
[Kotlin Tutorial] 함수 정의하고 호출하기 #1 - Chap 3. Defining and calling functions [Kotlin Tutorial] 함수 정의하고 호출하기 #1 - Chap 3. Defining and calling functions 참조 : Kotlin in Action 3.1. Creating collections in Kotlin -아래와 같이 쉽게 collection 을 만들 수 있다."type”Of 의 form 이다.val hashSet = hashSetOf(1, 7, 53) // mutableval set = setOf(“Gamza”, “Goguma”) // immutable val list = arrayListOf(1, 7, 53) // mutable val map = hashMapOf(1 to “one”, 7 to “seven”, 53 to “fifty-three”) // mutable/.. 2017. 8. 3.
[Kotlin Tutorial] Kotlin 기초 #2 - Chap2. Kotlin basics [Kotlin Tutorial] Kotlin 기초 #2 - Chap2. Kotlin basics 참조 : Kotlin in Action 2.4. Iterating over things: "While" and "For" loops -Kotlin 에서 for loop 은 for-each loop 하나밖에 없다. 2.4.1. The “while” loop -Java 와 동일 2.4.2. Iterating over numbers: ranges and progressions -일반적인 for loop 를 쓰려면 range 를 쓰면 된다.Range 는 closed, inclusive 하다 즉 아래의 예에서는 1과 10 모두를 포함한다.val oneToTen = 1..10 -val hundredToOneWithSte.. 2017. 7. 25.
[Kotlin Tutorial] Kotlin 소개 - Kotlin : what and why [Kotlin Tutorial] Kotlin 소개 - Kotlin : what and why 참조 : Kotlin in Action -Kotlin 은 Java platform 을 targeting 한 새로운 프로그래밍 언어.Java 코드와 함께 쓰일 수 있다.Android 개발 뿐만 아니라 Server-side 개발에도 쓰일 수 있다. -Java 의 iib, framework 와 함께 쓰일 수 있고, Java 와 비교해 Performance 도 거의 동일하다. 1.1. A Taste of Kotlin -http://try.kotl.in 을 통해 코드 실습을 할 수 있다. -data class Person(val name: String, val age: Int? = null) fun main(args: A.. 2017. 7. 12.
반응형