(messageSender, address, unidentifiedAccess) -> messageSender.sendTyping(List.of(address),
List.of(unidentifiedAccess),
message,
- null).get(0));
+ null).getFirst());
handleSendMessageResult(result);
return result;
}
logger.warn("Failed to read storage records, ignoring.");
return null;
}
- return !records.isEmpty() ? records.get(0) : null;
+ return !records.isEmpty() ? records.getFirst() : null;
}
private List<SignalStorageRecord> getSignalStorageRecords(final Collection<StorageId> storageIds) throws IOException {
r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber()));
case IdentityVerificationCode.ScannableSafetyNumber safetyNumber -> trustIdentity(recipient,
r -> context.getIdentityHelper().trustIdentityVerifiedSafetyNumber(r, safetyNumber.safetyNumber()));
- case null, default -> throw new AssertionError("Invalid verification code type");
+ case null -> throw new AssertionError("Invalid verification code type");
};
}
"Multiple users found, you need to specify an account (phone number) with -a");
}
- return accounts.get(0).getPath();
+ return accounts.getFirst().getPath();
} catch (UnknownMethod e) {
// dbus daemon not running in multi-account mode
return null;
}
@Override
- @SuppressWarnings("unchecked")
public Map<String, Variant<?>> GetAll(final String interface_name) {
final var handler = getHandlerOptional(interface_name);
if (handler.isEmpty()) {
@Override
public boolean isRegistered(String number) {
var result = isRegistered(List.of(number));
- return result.get(0);
+ return result.getFirst();
}
@Override
/**
* Represents a JSON-RPC (batch) request or (batch) response.
- * https://www.jsonrpc.org/specification
+ * <a href="https://www.jsonrpc.org/specification">https://www.jsonrpc.org/specification</a>
*/
-public sealed abstract class JsonRpcMessage permits JsonRpcBatchMessage, JsonRpcRequest, JsonRpcResponse {
-
-}
+public sealed abstract class JsonRpcMessage permits JsonRpcBatchMessage, JsonRpcRequest, JsonRpcResponse {}
/**
* Represents a JSON-RPC request.
- * https://www.jsonrpc.org/specification#request_object
+ * <a href="https://www.jsonrpc.org/specification#request_object">https://www.jsonrpc.org/specification#request_object</a>
*/
public final class JsonRpcRequest extends JsonRpcMessage {
/**
* Represents a JSON-RPC response.
- * https://www.jsonrpc.org/specification#response_object
+ * <a href="https://www.jsonrpc.org/specification#response_object">https://www.jsonrpc.org/specification#response_object</a>
*/
public final class JsonRpcResponse extends JsonRpcMessage {
if (manager == null) {
final var managers = c.getManagers();
if (managers.size() == 1) {
- manager = managers.get(0);
+ manager = managers.getFirst();
}
}
if (manager != null) {
private void unsubscribeReceive(final Manager m) {
final var subscriptionId = receiveHandlers.entrySet()
.stream()
- .filter(e -> e.getValue().size() == 1 && e.getValue().get(0).first().equals(m))
+ .filter(e -> e.getValue().size() == 1 && e.getValue().getFirst().first().equals(m))
.map(Map.Entry::getKey)
.findFirst();
subscriptionId.ifPresent(this::unsubscribeReceive);
if (strings.isEmpty()) {
return "";
}
- return strings.get(0) + strings.stream()
+ return strings.getFirst() + strings.stream()
.skip(1)
.filter(s -> !s.isEmpty())
.map(s -> Character.toUpperCase(s.charAt(0)) + s.substring(1).toLowerCase(Locale.ROOT))