Skip to content

Commit

Permalink
Refactor: map -> partition 으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Guri999 committed Jan 10, 2025
1 parent 1dda89d commit f44f8c8
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions feature/explore/src/main/java/kr/co/explore/ExploreViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,12 @@ internal class ExploreViewModel(
copy(path = path)
}

readPDFOrDirectory(path).map { file ->
if (file.isDirectory) {
reduce {
copy(
folders = folders + file
)
}
} else {
reduce {
copy(
files = files + file
)
}
readPDFOrDirectory(path).partition { it.isDirectory }.let { (folders, files) ->
reduce {
copy(
folders = folders,
files = files,
)
}
}
}
Expand Down

0 comments on commit f44f8c8

Please sign in to comment.