Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 암호학
- 프로그래머스
- GitHub
- livedata
- MyVoca
- architecture
- Compose
- activity
- 백준
- Rxjava
- pandas
- Python
- androidStudio
- Hilt
- Coroutine
- textfield
- 코루틴
- relay
- 쿠링
- android
- ProGuard
- Gradle
- 코드포스
- MiTweet
- Kotlin
- Coroutines
- Codeforces
- TEST
- AWS
- boj
Archives
- Today
- Total
이동식 저장소
[Kotlin] for? forEach? 본문
일반적인 for문과 ``Collections<T>.forEach()`` 중 뭘 써야 하나요?
JetBrains의 Kotlin 개발자들이 쓴 Kotlin in Action에 이런 구절이 있다.
The forEach function is somewhat more concise than a regular for loop, but it doesn’t have many other advantages, so you needn’t rush to convert all your loops to lambdas.
요약하면 ``forEach``가 읽기 쉬운 건 맞지만, for문을 모두 바꿔야 할 만큼 명확한 이점이 있는 것은 아니라고 한다. 각자 편한 걸 쓰는 걸로.
'Primary > Kotlin' 카테고리의 다른 글
[Kotlin] 제네릭 타입 제한하기 (0) | 2022.06.10 |
---|---|
[Kotlin] &&와 and의 차이 (0) | 2022.06.03 |
[Kotlin] sealed class (0) | 2022.05.20 |
[Kotlin] Nested Class, Inner Class (0) | 2022.05.19 |
[Kotlin] abstract class (0) | 2022.05.18 |
Comments