mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 18:40:39 +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
|
@ -37,7 +37,6 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DaemonCommand implements MultiLocalCommand, LocalCommand {
|
||||
|
||||
|
@ -317,7 +316,7 @@ public class DaemonCommand implements MultiLocalCommand, LocalCommand {
|
|||
.filter(Objects::nonNull)
|
||||
.map(m -> exportMultiAccountManager(connection, m, noReceiveOnStart))
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
for (var t : initThreads) {
|
||||
try {
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.io.IOException;
|
|||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class GetUserStatusCommand implements JsonRpcLocalCommand {
|
||||
|
||||
|
@ -53,7 +52,7 @@ public class GetUserStatusCommand implements JsonRpcLocalCommand {
|
|||
final var number = entry.getValue().first();
|
||||
final var uuid = entry.getValue().second();
|
||||
return new JsonUserStatus(entry.getKey(), number, uuid == null ? null : uuid.toString(), uuid != null);
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
jsonWriter.write(jsonUserStatuses);
|
||||
} else {
|
||||
|
|
|
@ -9,8 +9,6 @@ import org.asamk.signal.output.JsonWriter;
|
|||
import org.asamk.signal.output.OutputWriter;
|
||||
import org.asamk.signal.output.PlainTextWriter;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ListAccountsCommand implements JsonRpcMultiLocalCommand {
|
||||
|
||||
@Override
|
||||
|
@ -29,7 +27,7 @@ public class ListAccountsCommand implements JsonRpcMultiLocalCommand {
|
|||
) throws CommandException {
|
||||
final var accountNumbers = c.getAccountNumbers();
|
||||
if (outputWriter instanceof JsonWriter jsonWriter) {
|
||||
final var jsonAccounts = accountNumbers.stream().map(JsonAccount::new).collect(Collectors.toList());
|
||||
final var jsonAccounts = accountNumbers.stream().map(JsonAccount::new).toList();
|
||||
jsonWriter.write(jsonAccounts);
|
||||
} else if (outputWriter instanceof PlainTextWriter plainTextWriter) {
|
||||
for (final var number : accountNumbers) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.asamk.signal.output.OutputWriter;
|
|||
import org.asamk.signal.output.PlainTextWriter;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ListContactsCommand implements JsonRpcLocalCommand {
|
||||
|
||||
|
@ -48,7 +47,7 @@ public class ListContactsCommand implements JsonRpcLocalCommand {
|
|||
contact.getName(),
|
||||
contact.isBlocked(),
|
||||
contact.getMessageExpirationTime());
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
writer.write(jsonContacts);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ListDevicesCommand implements JsonRpcLocalCommand {
|
||||
|
||||
|
@ -56,7 +55,7 @@ public class ListDevicesCommand implements JsonRpcLocalCommand {
|
|||
final var writer = (JsonWriter) outputWriter;
|
||||
final var jsonDevices = devices.stream()
|
||||
.map(d -> new JsonDevice(d.id(), d.name(), d.created(), d.lastSeen()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
writer.write(jsonDevices);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ public class ListGroupsCommand implements JsonRpcLocalCommand {
|
|||
group.permissionEditDetails().name(),
|
||||
group.permissionSendMessage().name(),
|
||||
groupInviteLink == null ? null : groupInviteLink.getUrl());
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
jsonWriter.write(jsonGroups);
|
||||
} else {
|
||||
|
|
|
@ -18,7 +18,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ListIdentitiesCommand implements JsonRpcLocalCommand {
|
||||
|
||||
|
@ -76,7 +75,7 @@ public class ListIdentitiesCommand implements JsonRpcLocalCommand {
|
|||
: Base64.getEncoder().encodeToString(scannableSafetyNumber),
|
||||
id.trustLevel().name(),
|
||||
id.dateAdded().getTime());
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
writer.write(jsonIdentities);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class UpdateGroupCommand implements JsonRpcLocalCommand {
|
||||
|
@ -160,8 +159,7 @@ public class UpdateGroupCommand implements JsonRpcLocalCommand {
|
|||
groupMessageResults = results;
|
||||
} else {
|
||||
groupMessageResults = new SendGroupMessageResults(results.timestamp(),
|
||||
Stream.concat(groupMessageResults.results().stream(), results.results().stream())
|
||||
.collect(Collectors.toList()));
|
||||
Stream.concat(groupMessageResults.results().stream(), results.results().stream()).toList());
|
||||
}
|
||||
}
|
||||
outputResult(outputWriter, groupMessageResults, isNewGroup ? groupId : null);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue