일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- crawler
- Android
- Class
- pushnamed
- ML
- 웹크롤러
- textstyle
- set
- 클래스
- 크롤러
- 파이썬
- package
- Collection
- 함수
- 콜렉션
- python
- animation
- texttheme
- variable
- 코틀린
- List
- Flutter
- 다트
- DART
- map
- import
- function
- kotlin
- text
- 플러터
- Today
- Total
목록kotlin (40)
조용한 담장
코틀린의 collection 의 List Specific Operations 에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/list-operations.html 을 보며 정리. Retrieving elements by index index 가 list 의 크기보다 클때 발생하는 exception 을 피하는 함수 getOrElse() getOrNull() val numbers = listOf(1, 2, 3, 4) println(numbers.get(0)) // 1 println(numbers[0]) // 1 //numbers.get(5) // exception! println(numbers.getOrNull(5)) // null println(numbers.g..
코틀린의 collection 의 Write Operations 에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/collection-write.html 을 보며 정리. Mutable collections 의 내용을 변경하는 동작을 살펴보자. Adding elements add() 를 사용한다. val numbers = mutableListOf(1, 2, 3, 4) numbers.add(5) println(numbers) // output: // [1, 2, 3, 4, 5] addAll()는 argument collection 의 모든 element 를 추가한다. argument 로는 Set, List 외에도 Iterable, Sequence, Array 가 올 ..
코틀린의 collection 의 Aggregate Operations 에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/collection-aggregate.html을 보며 정리. min() and max() return the smallest and the largest element respectively; average() returns the average value of elements in the collection of numbers; sum() returns the sum of elements in the collection of numbers; count() returns the number of elements in a collection; v..
코틀린의 collection 의 Ordering 에 대해 살펴보자. 원문 https://kotlinlang.org/docs/reference/collection-ordering.html 을 보며 정리. element 의 순서는 특정 collection type 에 따라서는 중요한 부분이다. 예를 들어 같은 element 를 가진 두개의 리스트는 element 의 order 에 따라 동일하지 않게 된다. 코틀린에서 object 의 order 는 다양한 방법으로 정의될 수 있다. natural order 는 Comparable interface 의 상속자를 위해 정의 되었다. 특별한 order 가 지정되지 않으면 기본으로 사용된다. Numeric type 은 전통적인 수 기반 순서(numerical orde..