일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- pushnamed
- animation
- text
- 함수
- kotlin
- 플러터
- set
- Class
- textstyle
- 코틀린
- 클래스
- DART
- Collection
- function
- List
- Android
- package
- 다트
- Flutter
- map
- ML
- 파이썬
- texttheme
- 콜렉션
- import
- python
- variable
- crawler
- 크롤러
- 웹크롤러
- Today
- Total
목록kotlin (41)
조용한 담장

코틀린의 고차함수(higher-order function) 와 람다(lambda)에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/lambdas.html 을 보며 정리. 코틀린 함수는 first-class 이다. 이는 함수가 변수나 data structures 에 저장되거나 argument 로 전달되거나 다른 higher-order 함수로 부터 리턴될 수 있다는 의미이다. 이를 위해 코틀린은 statically typed programming language 로써, 함수를 나타내기 위해 함수 타입 (function types)을 사용하며 람다 표현식(lambda expression) 같은 특별한 언어 구성들을 제공한다. Higher-Order Functions ..

코틀린(kotlin) 의 함수 (funciton) 에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/functions.html 을 보며 정리. Function declarations 함수 정의는 fun 키워드를 사용한다. fun double(x: Int): Int { return 2 * x } Function usage 함수 호출 val result = double(2) 멤버 함수 호출 Stream().read() // create instance of class Stream and call read() Parameters 함수 파라미터는 Pascal notation 을 써서 정의한다. 각 파라미터는 type 이 정의되어야 한다. fun powerOf(numbe..

코틀린(kotlin) 클래스의 위임(delegation) 을 살펴보자. 원문 https://kotlinlang.org/docs/reference/delegation.html 을 보며 정리. Implementation by Delegation kotlin 은 상속의 대안이 되는 Delegation pattern 을 boilerplate code 없이 지원한다. 아래 예제에서, Derived 클래스는 자신의 모든 public 멤버들을 특정 오브젝트(BaseImpl)로 위임하여 Base 인터페이스를 구현할 수 있다. interface Base { fun print() } class BaseImpl(val x: Int) : Base { override fun print() { print(x) } } class ..

코틀린 클래스의 Object Expressions and Declarations 를 살펴보자 원문 https://kotlinlang.org/docs/reference/object-declarations.html 을 보며 정리. 새로운 클래스를 만들지 않고 특정 클래스에 약간의 수정만 한 오브젝트를 만드는 방법에 대해 살펴본다. Object expressions 특정 type 을 상속한 익명(이름없는) 클래스(anonymous class) 의 오브젝트를 생성하는 방법 window.addMouseListener(object : MouseAdapter() { override fun mouseClicked(e: MouseEvent) { /*...*/ } override fun mouseEntered(e: Mou..