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 | 31 |
Tags
- textview
- BottomSheetDialog
- ArrayList
- ROOM
- 랜덤ID
- Kotlin
- firebasefunctions
- androidstudio
- 안드로이드 스튜디오
- 뷰바인딩
- lifecyclescope
- button
- Dialog
- nav_graph
- Android
- 안드로이드스튜디오
- Activity
- 안드로이드
- ButtonWithButton
- OutlinedButton
- ViewModel
- MaterialButton
- 코틀린
- 밑줄
- RealtimeDB
- firebase
- FRAGMENT
- EditText
- Imageview
- 팝업액티비티
Archives
- Today
- Total
목록정렬 (1)
GA4 교육
ArrayList에 들어있는 객체들을 정렬하고 싶다... - Kotlin
프로젝트를 하다보면, ArrayList 안에 있는 객체들을 정렬하고 싶을 때가 있다. 만약 T가 Class 형태라면 T의 요소들로 정렬을 할 수가 있다. //data라는 arraylist안에 있는 객체를 정리하는데, T의 customerName을 비교해서 정렬한다. data.sortBy { T -> T.customerName } dataForSearch.sortBy { T -> T.customerName } //default값이 오름차순이기 때문에 내림차순으로 정리하고 싶다면 아래 함수를 사용한다. data.sortByDescending { data1 -> data1.savedate } dataForSearch.sortByDescending { data1 -> data1.savedate }
카테고리 없음
2021. 5. 24. 15:40