일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 31 |
- 플러터
- pushnamed
- Flutter
- animation
- textstyle
- 파이썬
- 코틀린
- 클래스
- Collection
- set
- List
- 콜렉션
- Class
- 웹크롤러
- 크롤러
- map
- 다트
- import
- variable
- package
- Yocto
- function
- DART
- crawler
- 함수
- text
- Android
- python
- kotlin
- ML
- Today
- Total
목록kotlin (40)
조용한 담장
코틀린의 collection 의 Retrieving Single Elements 에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/collection-elements.html 을 보며 정리. Retrieving by position elementAt() 을 사용하여 collection 의 특정 위치의 element 를 얻는다. 첫번째 위치는 0, 마지막은 (size - 1) 이다. indexed access operator 인 get() 와 [] 도 비슷한 동작을 한다. val numbers = linkedSetOf("one", "two", "three", "four", "five") println(numbers.elementAt(3)) val numbersSo..
코틀린의 collection 의 Retrieving Collection Parts 에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/collection-parts.html 을 보며 정리. Slice slice() 를 사용하여 지정된 위치의 element 로 새로운 list 를 구성한다. range 나 위치를 표현하는 상수 값을 가진 collection 을 전달하여 위치값을 전달 할 수 있다. val numbers = listOf("one", "two", "three", "four", "five", "six") println(numbers.slice(1..3)) println(numbers.slice(0..4 step 2)) println(numbers.slice..
코틀린의 collection 의 plus and minus Operators 와 Grouping 에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/collection-plus-minus.html 와 https://kotlinlang.org/docs/reference/collection-grouping.html 을 보며 정리. plus and minus Operators plus (+) 와 minus (-) 연산자들의 결과로 read-only collection 이 생성된다. minus 는 두번째 피연산자의 element 들을 원본 collection 에서 제외한 결과를 리턴한다. val numbers = listOf("one", "two", "three", "f..
코틀린의 collection 의 transformation 에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/collection-filtering.html 을 보며 정리. 필터링은 전달된 람다함수가 collection 의 element 을 가지고 도출한 boolean 결과값이 true 이면 해당 element 값을 사용하고 false 이면 버린다. standard library 는 filtering 을 위한 많은 확장 함수들을 하나의 호출을 통해 사용될수 있도록 제공한다. 이 함수들은 원본 collection 을 변경시키지 않고 보존하므로 mutable 과 read-only collection 모두에 사용이 가능하다. filtering 의 결과는 변수에 저장하거..