From 5848ec21f709e6bea460f65e62371cddd858c607 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 20 Apr 2021 18:16:03 +0200 Subject: [PATCH] use orEmpty() --- .../im/vector/app/features/invite/InviteUsersToRoomViewModel.kt | 2 +- .../vector/app/features/roomdirectory/RoomDirectoryViewModel.kt | 2 +- .../im/vector/app/features/userdirectory/UserListViewModel.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomViewModel.kt b/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomViewModel.kt index 55730ff4ec..2f20fef3c9 100644 --- a/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/invite/InviteUsersToRoomViewModel.kt @@ -92,6 +92,6 @@ class InviteUsersToRoomViewModel @AssistedInject constructor(@Assisted } fun getUserIdsOfRoomMembers(): Set { - return room.roomSummary()?.otherMemberIds?.toSet() ?: emptySet() + return room.roomSummary()?.otherMemberIds?.toSet().orEmpty() } } diff --git a/vector/src/main/java/im/vector/app/features/roomdirectory/RoomDirectoryViewModel.kt b/vector/src/main/java/im/vector/app/features/roomdirectory/RoomDirectoryViewModel.kt index 7b55e38764..cfc8d9f099 100644 --- a/vector/src/main/java/im/vector/app/features/roomdirectory/RoomDirectoryViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/roomdirectory/RoomDirectoryViewModel.kt @@ -87,7 +87,7 @@ class RoomDirectoryViewModel @AssistedInject constructor( val joinedRoomIds = list ?.map { it.roomId } ?.toSet() - ?: emptySet() + .orEmpty() setState { copy(joinedRoomsIds = joinedRoomIds) diff --git a/vector/src/main/java/im/vector/app/features/userdirectory/UserListViewModel.kt b/vector/src/main/java/im/vector/app/features/userdirectory/UserListViewModel.kt index 77f6c3f4eb..3e1e06d47e 100644 --- a/vector/src/main/java/im/vector/app/features/userdirectory/UserListViewModel.kt +++ b/vector/src/main/java/im/vector/app/features/userdirectory/UserListViewModel.kt @@ -119,7 +119,7 @@ class UserListViewModel @AssistedInject constructor(@Assisted initialState: User Single.just(emptyList()) } else { val searchObservable = session.rx() - .searchUsersDirectory(search, 50, state.excludedUserIds ?: emptySet()) + .searchUsersDirectory(search, 50, state.excludedUserIds.orEmpty()) .map { users -> users.sortedBy { it.toMatrixItem().firstLetterOfDisplayName() } }