본문 바로가기
[도서 정리] Android Development with Kotlin - Playing with Functions Android Development with Kotlin - Playing with Functions 이 정리글은 Kotlin in Action 책을 보고 실무에 Kotlin 을 사용하던 사람이 몰랐던 내용이나 remind 하고 싶은 내용을 위주로 정리한 글입니다.제대로 내용을 파악하시려면 책을 구매해서 읽어보세욤~ -Function 과 Method 를 구분하는 논리..Function 은 이름을 가진 Code 조각.Method 는 class 와 연관되어진 function. member function 을 method 라 부른다. 논란의 여지는 있는데 Java 에는 Method 만 있다는 의견이 많다.일각에서는 static function 은 function 이라고 이야기하기도 한다. Kotlin 에서의 .. 2018. 12. 12.
[Kotlin] Kotlin 의 숨겨진 비용 #2 [Kotlin] Kotlin 의 숨겨진 비용 #2 https://medium.com/@BladeCoder/exploring-kotlins-hidden-costs-part-2-324a4a50b70 Local functions -local function 의 limit 은 inline 으로 정의될 수 없다는 것 ( 글 쓴 당시까지는, 현재버전에서 꼭 체크해보라 ).그리고 local function 을 가지고 있는 녀석도 inline 이 될 수 없다.fun someMth(a: Int): Int { fun sumSquare(b: Int) = (a+b) * (a+b) return sumSquare(1) + sumSqaure(2)} local function 은 Function object 로 바뀐다.public .. 2018. 1. 17.
[Objective-C] Foundation 프레임워크의 중요 클래스 - NSString, NSMutableString [Objective-C] Foundation 프레임워크의 중요 클래스 - NSString, NSMutableString 출처 : OS X 구조를 이해하면서 배우는 Objective-C Chap 9. Notice : 정리자(돼지왕 왕돼지)가 remind 하고 싶은 내용이나 모르는 내용 기반으로 정리하는 것이기 때문에 구체적인 내용은 책을 사서 보시기를 권장드립니다. 9.1. 객체 변경 가능성 * 9.1.1. 변경 가능 객체와 불가능 객체 * 9.1.2. 변경 가능 객체 작성 -변경 불가능 객체를 변경 가능 객체로 다루고 싶을 때는 어떻게 할까?mutableCopy 메서드로 변경 가능한 복사본을 작성한다. 9.2. 문자열 클래스 * 9.2.1. 객체 상수 문자열 -문자열을 “ “ 로 둘러싸고 그 앞에 @ 를.. 2017. 12. 30.
[Kotlin Tutorial] Annotation 과 Reflection #2 [Kotlin Tutorial] Annotation 과 Reflection #2 참조 : Kotlin in action 10.2. Reflection: introspecting Kotlin objects at runtime -Kotlin 에서의 reflection 은 java.lang.reflect package 의 API 들과 kotlin.reflect package 의 API 들을 사용한다.Kotlin 의 reflection 은 Java 에 없는 nullable type 이나 properties 들의 접근을 가능하게 한다. -runtime lib 의 size 를 줄이기 위해, kotlin 의 reflection API 는 kotlin-reflect.jar 라는 별개의 jar 로 pakcage 되어 있.. 2017. 9. 12.
[Kotlin Tutorial] Annotation 과 Reflection #1 - Chap 10. Annotations and reflection [Kotlin Tutorial] Annotation 과 Reflection #1 - Chap 10. Annotations and reflection 참조 : Kotlin in action 10.1. Declaring and applying annotations. 10.1.1. Applying annotations -Annotation 사용법은 Java 와 동일하다. @ 를 prefix 로 하고 annotation name 을 써주면 된다. -@Deprecated 의 경우 Kotlin 은 Java 의 것에서 향상되었다.replaceWith parameter 가 추가되어, 새로운 version 의 API 에 연결될 수 있다.@Deprecated(“Use removeAt(index) instead.”, Rep.. 2017. 9. 7.
[Kotlin Tutorial] Kotlin 의 Type system #2 [Kotlin Tutorial] Kotlin 의 Type system #2 참조 : Kotlin in action 6.2. Primitive and other basic types 6.2.1. Primitive types: Int, Boolean, and more -Kotlin 은 primitive type 과 wrapper type 을 구분하지 않는다. -그렇다면 Int 가 object 라면 Kotlin 은 모든 primitive type 을 실제로 object 로 만드는가?당연히 그렇게 안 했다.compiler 가 대부분의 Int type 을 Java 의 primitive type 으로 변형시킨다.generic, collection 등은 원래 Java 의 Integer 형태만 담을 수 있으므로 이 경.. 2017. 8. 22.
[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.
반응형