mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Replace collect(Collectors.toList()) with toList()
This commit is contained in:
parent
06e93b84da
commit
62687d103f
41 changed files with 106 additions and 199 deletions
|
@ -40,7 +40,6 @@ import java.util.Optional;
|
|||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public interface Manager extends Closeable {
|
||||
|
||||
|
@ -90,7 +89,7 @@ public interface Manager extends Closeable {
|
|||
.filter(File::isFile)
|
||||
.map(File::getName)
|
||||
.filter(file -> PhoneNumberFormatter.isValidNumber(file, null))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
String getSelfNumber();
|
||||
|
|
|
@ -445,7 +445,7 @@ public class ManagerImpl implements Manager {
|
|||
d.getCreated(),
|
||||
d.getLastSeen(),
|
||||
d.getId() == account.getDeviceId());
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -517,7 +517,7 @@ public class ManagerImpl implements Manager {
|
|||
|
||||
@Override
|
||||
public List<Group> getGroups() {
|
||||
return account.getGroupStore().getGroups().stream().map(this::toGroup).collect(Collectors.toList());
|
||||
return account.getGroupStore().getGroups().stream().map(this::toGroup).toList();
|
||||
}
|
||||
|
||||
private Group toGroup(final GroupInfo groupInfo) {
|
||||
|
@ -628,7 +628,7 @@ public class ManagerImpl implements Manager {
|
|||
.map(sendMessageResult -> SendMessageResult.from(sendMessageResult,
|
||||
account.getRecipientStore(),
|
||||
account.getRecipientStore()::resolveRecipientAddress))
|
||||
.collect(Collectors.toList()));
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
return new SendMessageResults(timestamp, results);
|
||||
|
@ -657,7 +657,7 @@ public class ManagerImpl implements Manager {
|
|||
.map(r -> SendMessageResult.from(r,
|
||||
account.getRecipientStore(),
|
||||
account.getRecipientStore()::resolveRecipientAddress))
|
||||
.collect(Collectors.toList()));
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
return new SendMessageResults(timestamp, results);
|
||||
|
@ -1283,7 +1283,7 @@ public class ManagerImpl implements Manager {
|
|||
.getContacts()
|
||||
.stream()
|
||||
.map(p -> new Pair<>(account.getRecipientStore().resolveRecipientAddress(p.first()), p.second()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1319,11 +1319,7 @@ public class ManagerImpl implements Manager {
|
|||
|
||||
@Override
|
||||
public List<Identity> getIdentities() {
|
||||
return account.getIdentityKeyStore()
|
||||
.getIdentities()
|
||||
.stream()
|
||||
.map(this::toIdentity)
|
||||
.collect(Collectors.toList());
|
||||
return account.getIdentityKeyStore().getIdentities().stream().map(this::toIdentity).toList();
|
||||
}
|
||||
|
||||
private Identity toIdentity(final IdentityInfo identityInfo) {
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MultiAccountManagerImpl implements MultiAccountManager {
|
||||
|
||||
|
@ -46,7 +45,7 @@ public class MultiAccountManagerImpl implements MultiAccountManager {
|
|||
@Override
|
||||
public List<String> getAccountNumbers() {
|
||||
synchronized (managers) {
|
||||
return managers.stream().map(Manager::getSelfNumber).collect(Collectors.toList());
|
||||
return managers.stream().map(Manager::getSelfNumber).toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -135,9 +135,7 @@ public record MessageEnvelope(
|
|||
.transform(p -> p.getPaymentNotification().isPresent() ? Payment.from(p) : null)
|
||||
.orNull()),
|
||||
dataMessage.getAttachments()
|
||||
.transform(a -> a.stream()
|
||||
.map(as -> Attachment.from(as, fileProvider))
|
||||
.collect(Collectors.toList()))
|
||||
.transform(a -> a.stream().map(as -> Attachment.from(as, fileProvider)).toList())
|
||||
.or(List.of()),
|
||||
Optional.ofNullable(dataMessage.getRemoteDelete()
|
||||
.transform(SignalServiceDataMessage.RemoteDelete::getTargetSentTimestamp)
|
||||
|
@ -146,17 +144,15 @@ public record MessageEnvelope(
|
|||
dataMessage.getSharedContacts()
|
||||
.transform(a -> a.stream()
|
||||
.map(sharedContact -> SharedContact.from(sharedContact, fileProvider))
|
||||
.collect(Collectors.toList()))
|
||||
.toList())
|
||||
.or(List.of()),
|
||||
dataMessage.getMentions()
|
||||
.transform(a -> a.stream()
|
||||
.map(m -> Mention.from(m, recipientResolver, addressResolver))
|
||||
.collect(Collectors.toList()))
|
||||
.toList())
|
||||
.or(List.of()),
|
||||
dataMessage.getPreviews()
|
||||
.transform(a -> a.stream()
|
||||
.map(preview -> Preview.from(preview, fileProvider))
|
||||
.collect(Collectors.toList()))
|
||||
.transform(a -> a.stream().map(preview -> Preview.from(preview, fileProvider)).toList())
|
||||
.or(List.of()));
|
||||
}
|
||||
|
||||
|
@ -223,19 +219,18 @@ public record MessageEnvelope(
|
|||
: quote.getMentions()
|
||||
.stream()
|
||||
.map(m -> Mention.from(m, recipientResolver, addressResolver))
|
||||
.collect(Collectors.toList()),
|
||||
.toList(),
|
||||
quote.getAttachments() == null
|
||||
? List.of()
|
||||
: quote.getAttachments()
|
||||
.stream()
|
||||
.map(a -> Attachment.from(a, fileProvider))
|
||||
.collect(Collectors.toList()));
|
||||
: quote.getAttachments().stream().map(a -> Attachment.from(a, fileProvider)).toList());
|
||||
}
|
||||
}
|
||||
|
||||
public record Payment(String note, byte[] receipt) {
|
||||
|
||||
static Payment from(SignalServiceDataMessage.Payment payment) {
|
||||
return new Payment(payment.getPaymentNotification().get().getNote(), payment.getPaymentNotification().get().getReceipt());
|
||||
return new Payment(payment.getPaymentNotification().get().getNote(),
|
||||
payment.getPaymentNotification().get().getReceipt());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,15 +346,9 @@ public record MessageEnvelope(
|
|||
Optional.ofNullable(sharedContact.getAvatar()
|
||||
.transform(avatar1 -> Avatar.from(avatar1, fileProvider))
|
||||
.orNull()),
|
||||
sharedContact.getPhone()
|
||||
.transform(p -> p.stream().map(Phone::from).collect(Collectors.toList()))
|
||||
.or(List.of()),
|
||||
sharedContact.getEmail()
|
||||
.transform(p -> p.stream().map(Email::from).collect(Collectors.toList()))
|
||||
.or(List.of()),
|
||||
sharedContact.getAddress()
|
||||
.transform(p -> p.stream().map(Address::from).collect(Collectors.toList()))
|
||||
.or(List.of()),
|
||||
sharedContact.getPhone().transform(p -> p.stream().map(Phone::from).toList()).or(List.of()),
|
||||
sharedContact.getEmail().transform(p -> p.stream().map(Email::from).toList()).or(List.of()),
|
||||
sharedContact.getAddress().transform(p -> p.stream().map(Address::from).toList()).or(List.of()),
|
||||
Optional.ofNullable(sharedContact.getOrganization().orNull()));
|
||||
}
|
||||
|
||||
|
@ -528,12 +517,12 @@ public record MessageEnvelope(
|
|||
syncMessage.getRead()
|
||||
.transform(r -> r.stream()
|
||||
.map(rm -> Read.from(rm, recipientResolver, addressResolver))
|
||||
.collect(Collectors.toList()))
|
||||
.toList())
|
||||
.or(List.of()),
|
||||
syncMessage.getViewed()
|
||||
.transform(r -> r.stream()
|
||||
.map(rm -> Viewed.from(rm, recipientResolver, addressResolver))
|
||||
.collect(Collectors.toList()))
|
||||
.toList())
|
||||
.or(List.of()),
|
||||
Optional.ofNullable(syncMessage.getViewOnceOpen()
|
||||
.transform(rm -> ViewOnceOpen.from(rm, recipientResolver, addressResolver))
|
||||
|
@ -583,11 +572,7 @@ public record MessageEnvelope(
|
|||
return new Blocked(blockedListMessage.getAddresses()
|
||||
.stream()
|
||||
.map(d -> addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(d)))
|
||||
.collect(Collectors.toList()),
|
||||
blockedListMessage.getGroupIds()
|
||||
.stream()
|
||||
.map(GroupId::unknownVersion)
|
||||
.collect(Collectors.toList()));
|
||||
.toList(), blockedListMessage.getGroupIds().stream().map(GroupId::unknownVersion).toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -701,7 +686,7 @@ public record MessageEnvelope(
|
|||
Optional.ofNullable(callMessage.getHangupMessage().transform(Hangup::from).orNull()),
|
||||
Optional.ofNullable(callMessage.getBusyMessage().transform(Busy::from).orNull()),
|
||||
callMessage.getIceUpdateMessages()
|
||||
.transform(m -> m.stream().map(IceUpdate::from).collect(Collectors.toList()))
|
||||
.transform(m -> m.stream().map(IceUpdate::from).toList())
|
||||
.or(List.of()),
|
||||
Optional.ofNullable(callMessage.getOpaqueMessage().transform(Opaque::from).orNull()));
|
||||
}
|
||||
|
|
|
@ -55,7 +55,6 @@ import java.util.Collection;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GroupHelper {
|
||||
|
||||
|
@ -630,10 +629,7 @@ public class GroupHelper {
|
|||
var group = SignalServiceGroup.newBuilder(SignalServiceGroup.Type.UPDATE)
|
||||
.withId(g.getGroupId().serialize())
|
||||
.withName(g.name)
|
||||
.withMembers(g.getMembers()
|
||||
.stream()
|
||||
.map(addressResolver::resolveSignalServiceAddress)
|
||||
.collect(Collectors.toList()));
|
||||
.withMembers(g.getMembers().stream().map(addressResolver::resolveSignalServiceAddress).toList());
|
||||
|
||||
try {
|
||||
final var attachment = createGroupAvatarAttachment(g.getGroupId());
|
||||
|
@ -682,6 +678,6 @@ public class GroupHelper {
|
|||
.map(sendMessageResult -> SendMessageResult.from(sendMessageResult,
|
||||
recipientResolver,
|
||||
account.getRecipientStore()::resolveRecipientAddress))
|
||||
.collect(Collectors.toList()));
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ public class GroupV2Helper {
|
|||
.map(addressResolver::resolveSignalServiceAddress)
|
||||
.map(SignalServiceAddress::getAci)
|
||||
.map(ACI::uuid)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
final GroupsV2Operations.GroupOperations groupOperations = getGroupOperations(groupInfoV2);
|
||||
return commitChange(groupInfoV2,
|
||||
groupOperations.createLeaveAndPromoteMembersToAdmin(selfAci.uuid(), adminUuids));
|
||||
|
|
|
@ -33,7 +33,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SendHelper {
|
||||
|
||||
|
@ -227,9 +226,7 @@ public class SendHelper {
|
|||
}
|
||||
final var messageSender = dependencies.getMessageSender();
|
||||
final var recipientIdList = new ArrayList<>(g.getMembersWithout(account.getSelfRecipientId()));
|
||||
final var addresses = recipientIdList.stream()
|
||||
.map(addressResolver::resolveSignalServiceAddress)
|
||||
.collect(Collectors.toList());
|
||||
final var addresses = recipientIdList.stream().map(addressResolver::resolveSignalServiceAddress).toList();
|
||||
return messageSender.sendTyping(addresses,
|
||||
unidentifiedAccessHelper.getAccessFor(recipientIdList),
|
||||
message,
|
||||
|
@ -255,9 +252,7 @@ public class SendHelper {
|
|||
// isRecipientUpdate is true if we've already sent this message to some recipients in the past, otherwise false.
|
||||
final var isRecipientUpdate = false;
|
||||
final var recipientIdList = new ArrayList<>(recipientIds);
|
||||
final var addresses = recipientIdList.stream()
|
||||
.map(addressResolver::resolveSignalServiceAddress)
|
||||
.collect(Collectors.toList());
|
||||
final var addresses = recipientIdList.stream().map(addressResolver::resolveSignalServiceAddress).toList();
|
||||
return messageSender.sendDataMessage(addresses,
|
||||
unidentifiedAccessHelper.getAccessFor(recipientIdList),
|
||||
isRecipientUpdate,
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.io.IOException;
|
|||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class StorageHelper {
|
||||
|
||||
|
@ -72,7 +71,7 @@ public class StorageHelper {
|
|||
.getStorageIds()
|
||||
.stream()
|
||||
.filter(id -> !id.isUnknown() && id.getType() != ManifestRecord.Identifier.Type.ACCOUNT_VALUE)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
for (final var record : getSignalStorageRecords(storageIds)) {
|
||||
if (record.getType() == ManifestRecord.Identifier.Type.GROUPV2_VALUE) {
|
||||
|
|
|
@ -35,7 +35,6 @@ import java.io.InputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SyncHelper {
|
||||
|
||||
|
@ -89,7 +88,7 @@ public class SyncHelper {
|
|||
groupInfo.getMembers()
|
||||
.stream()
|
||||
.map(addressResolver::resolveSignalServiceAddress)
|
||||
.collect(Collectors.toList()),
|
||||
.toList(),
|
||||
groupHelper.createGroupAvatarAttachment(groupInfo.getGroupId()),
|
||||
groupInfo.isMember(account.getSelfRecipientId()),
|
||||
Optional.of(groupInfo.messageExpirationTime),
|
||||
|
|
|
@ -15,7 +15,6 @@ import org.whispersystems.signalservice.api.crypto.UnidentifiedAccessPair;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.whispersystems.signalservice.internal.util.Util.getSecretBytes;
|
||||
|
||||
|
@ -133,7 +132,7 @@ public class UnidentifiedAccessHelper {
|
|||
}
|
||||
|
||||
public List<Optional<UnidentifiedAccessPair>> getAccessFor(List<RecipientId> recipients) {
|
||||
return recipients.stream().map(this::getAccessFor).collect(Collectors.toList());
|
||||
return recipients.stream().map(this::getAccessFor).toList();
|
||||
}
|
||||
|
||||
public Optional<UnidentifiedAccessPair> getAccessFor(RecipientId recipient) {
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.whispersystems.signalservice.internal.util.Hex;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class RetrieveStickerPackJob implements Job {
|
||||
|
||||
|
@ -63,7 +62,7 @@ public class RetrieveStickerPackJob implements Job {
|
|||
.map(c -> new JsonStickerPack.JsonSticker(c.getEmoji(),
|
||||
String.valueOf(c.getId()),
|
||||
c.getContentType()))
|
||||
.collect(Collectors.toList()));
|
||||
.toList());
|
||||
context.getStickerPackStore().storeManifest(packId, jsonManifest);
|
||||
} catch (IOException e) {
|
||||
logger.warn("Failed to retrieve sticker pack {}: {}",
|
||||
|
|
|
@ -262,9 +262,7 @@ public class GroupStore {
|
|||
g1.messageExpirationTime,
|
||||
g1.blocked,
|
||||
g1.archived,
|
||||
g1.members.stream()
|
||||
.map(m -> new Storage.GroupV1.Member(m.id(), null, null))
|
||||
.collect(Collectors.toList()));
|
||||
g1.members.stream().map(m -> new Storage.GroupV1.Member(m.id(), null, null)).toList());
|
||||
}
|
||||
|
||||
final var g2 = (GroupInfoV2) g;
|
||||
|
@ -272,10 +270,10 @@ public class GroupStore {
|
|||
Base64.getEncoder().encodeToString(g2.getMasterKey().serialize()),
|
||||
g2.isBlocked(),
|
||||
g2.isPermissionDenied());
|
||||
}).collect(Collectors.toList()));
|
||||
}).toList());
|
||||
}
|
||||
|
||||
public record Storage(@JsonDeserialize(using = GroupsDeserializer.class) List<Object> groups) {
|
||||
public record Storage(@JsonDeserialize(using = GroupsDeserializer.class) List<Record> groups) {
|
||||
|
||||
private record GroupV1(
|
||||
String groupId,
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class IdentityKeyStore implements org.whispersystems.libsignal.state.IdentityKeyStore {
|
||||
|
||||
|
@ -165,7 +164,7 @@ public class IdentityKeyStore implements org.whispersystems.libsignal.state.Iden
|
|||
.map(f -> resolver.resolveRecipient(Long.parseLong(f.getName())))
|
||||
.filter(Objects::nonNull)
|
||||
.map(this::loadIdentityLocked)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
public void mergeRecipients(final RecipientId recipientId, final RecipientId toBeMergedRecipientId) {
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.nio.file.Files;
|
|||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class MessageCache {
|
||||
|
@ -46,7 +45,7 @@ public class MessageCache {
|
|||
return Stream.empty();
|
||||
}
|
||||
return Arrays.stream(files).filter(File::isFile);
|
||||
}).map(CachedMessage::new).collect(Collectors.toList());
|
||||
}).map(CachedMessage::new).toList();
|
||||
}
|
||||
|
||||
public CachedMessage cacheMessage(SignalServiceEnvelope envelope, RecipientId recipientId) {
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.nio.file.Files;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SignedPreKeyStore implements org.whispersystems.libsignal.state.SignedPreKeyStore {
|
||||
|
||||
|
@ -47,7 +46,7 @@ public class SignedPreKeyStore implements org.whispersystems.libsignal.state.Sig
|
|||
return Arrays.stream(files)
|
||||
.filter(f -> signedPreKeyFileNamePattern.matcher(f.getName()).matches())
|
||||
.map(this::loadSignedPreKeyRecord)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,7 +44,7 @@ public class LegacyJsonIdentityKeyStore {
|
|||
.collect(Collectors.toSet())
|
||||
.stream()
|
||||
.map(this::getIdentity)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
public IdentityKeyPair getIdentityKeyPair() {
|
||||
|
|
|
@ -203,7 +203,7 @@ public class RecipientStore implements RecipientResolver, ContactsStore, Profile
|
|||
toBeMerged.add(new Pair<>(pair.first(), pair.second().get()));
|
||||
}
|
||||
return pair.first();
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
}
|
||||
for (var pair : toBeMerged) {
|
||||
recipientMergeHandler.mergeRecipients(pair.first(), pair.second());
|
||||
|
@ -231,7 +231,7 @@ public class RecipientStore implements RecipientResolver, ContactsStore, Profile
|
|||
.stream()
|
||||
.filter(e -> e.getValue().getContact() != null)
|
||||
.map(e -> new Pair<>(e.getKey(), e.getValue().getContact()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -518,7 +518,7 @@ public class RecipientStore implements RecipientResolver, ContactsStore, Profile
|
|||
: base64.encodeToString(recipient.getProfileKeyCredential().serialize()),
|
||||
contact,
|
||||
profile);
|
||||
}).collect(Collectors.toList()), lastId);
|
||||
}).toList(), lastId);
|
||||
|
||||
// Write to memory first to prevent corrupting the file in case of serialization errors
|
||||
try (var inMemoryOutput = new ByteArrayOutputStream()) {
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.Objects;
|
|||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SenderKeyRecordStore implements org.whispersystems.libsignal.groups.state.SenderKeyStore {
|
||||
|
||||
|
@ -148,7 +147,7 @@ public class SenderKeyRecordStore implements org.whispersystems.libsignal.groups
|
|||
return new Key(recipientId, Integer.parseInt(matcher.group(2)), UUID.fromString(matcher.group(3)));
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
private File getSenderKeyFile(Key key) {
|
||||
|
|
|
@ -188,7 +188,7 @@ public class SenderKeySharedStore {
|
|||
.map(entry -> new Storage.SharedSenderKey(entry.recipientId().id(),
|
||||
entry.deviceId(),
|
||||
pair.getKey().asUuid().toString()));
|
||||
}).collect(Collectors.toList()));
|
||||
}).toList());
|
||||
|
||||
// Write to memory first to prevent corrupting the file in case of serialization errors
|
||||
try (var inMemoryOutput = new ByteArrayOutputStream()) {
|
||||
|
|
|
@ -59,13 +59,10 @@ public class SessionStore implements SignalServiceSessionStore {
|
|||
|
||||
@Override
|
||||
public List<SessionRecord> loadExistingSessions(final List<SignalProtocolAddress> addresses) throws NoSessionException {
|
||||
final var keys = addresses.stream().map(this::getKey).collect(Collectors.toList());
|
||||
final var keys = addresses.stream().map(this::getKey).toList();
|
||||
|
||||
synchronized (cachedSessions) {
|
||||
final var sessions = keys.stream()
|
||||
.map(this::loadSessionLocked)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
final var sessions = keys.stream().map(this::loadSessionLocked).filter(Objects::nonNull).toList();
|
||||
|
||||
if (sessions.size() != addresses.size()) {
|
||||
String message = "Mismatch! Asked for "
|
||||
|
@ -90,7 +87,7 @@ public class SessionStore implements SignalServiceSessionStore {
|
|||
// get all sessions for recipient except main device session
|
||||
.filter(key -> key.deviceId() != 1 && key.recipientId().equals(recipientId))
|
||||
.map(Key::deviceId)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +243,7 @@ public class SessionStore implements SignalServiceSessionStore {
|
|||
return new Key(recipientId, Integer.parseInt(matcher.group(2)));
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
private File getSessionFile(Key key) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class StickerStore {
|
|||
.map(s -> new Storage.Sticker(Base64.getEncoder().encodeToString(s.getPackId().serialize()),
|
||||
Base64.getEncoder().encodeToString(s.getPackKey()),
|
||||
s.isInstalled()))
|
||||
.collect(Collectors.toList()));
|
||||
.toList());
|
||||
}
|
||||
|
||||
public record Storage(List<Storage.Sticker> stickers) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue