use orEmpty()

This commit is contained in:
Benoit Marty 2021-04-20 18:16:03 +02:00
parent 2a3694d8b7
commit 5848ec21f7
3 changed files with 3 additions and 3 deletions

View File

@ -92,6 +92,6 @@ class InviteUsersToRoomViewModel @AssistedInject constructor(@Assisted
}
fun getUserIdsOfRoomMembers(): Set<String> {
return room.roomSummary()?.otherMemberIds?.toSet() ?: emptySet()
return room.roomSummary()?.otherMemberIds?.toSet().orEmpty()
}
}

View File

@ -87,7 +87,7 @@ class RoomDirectoryViewModel @AssistedInject constructor(
val joinedRoomIds = list
?.map { it.roomId }
?.toSet()
?: emptySet()
.orEmpty()
setState {
copy(joinedRoomsIds = joinedRoomIds)

View File

@ -119,7 +119,7 @@ class UserListViewModel @AssistedInject constructor(@Assisted initialState: User
Single.just(emptyList<User>())
} else {
val searchObservable = session.rx()
.searchUsersDirectory(search, 50, state.excludedUserIds ?: emptySet())
.searchUsersDirectory(search, 50, state.excludedUserIds.orEmpty())
.map { users ->
users.sortedBy { it.toMatrixItem().firstLetterOfDisplayName() }
}