Use Collections.addAll to copy elements from an array to collections
Change-Id: I048d005a0f75b0803be14f2128af682f0f834f8d
This commit is contained in:
@@ -69,9 +69,7 @@ public class AuthInfo extends JavaScriptObject {
|
|||||||
List<AgreementInfo> agreements = new ArrayList<>();
|
List<AgreementInfo> agreements = new ArrayList<>();
|
||||||
JsArray<AgreementInfo> contributorAgreements = _contributorAgreements();
|
JsArray<AgreementInfo> contributorAgreements = _contributorAgreements();
|
||||||
if (contributorAgreements != null) {
|
if (contributorAgreements != null) {
|
||||||
for (AgreementInfo a : Natives.asList(contributorAgreements)) {
|
agreements.addAll(Natives.asList(contributorAgreements));
|
||||||
agreements.add(a);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return agreements;
|
return agreements;
|
||||||
}
|
}
|
||||||
|
@@ -31,9 +31,7 @@ public class DownloadInfo extends JavaScriptObject {
|
|||||||
|
|
||||||
public final List<String> archives() {
|
public final List<String> archives() {
|
||||||
List<String> archives = new ArrayList<>();
|
List<String> archives = new ArrayList<>();
|
||||||
for (String f : Natives.asList(_archives())) {
|
archives.addAll(Natives.asList(_archives()));
|
||||||
archives.add(f);
|
|
||||||
}
|
|
||||||
return archives;
|
return archives;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1286,9 +1286,7 @@ public abstract class AbstractDaemonTest {
|
|||||||
protected void assertDiffForNewFile(
|
protected void assertDiffForNewFile(
|
||||||
DiffInfo diff, RevCommit commit, String path, String expectedContentSideB) throws Exception {
|
DiffInfo diff, RevCommit commit, String path, String expectedContentSideB) throws Exception {
|
||||||
List<String> expectedLines = new ArrayList<>();
|
List<String> expectedLines = new ArrayList<>();
|
||||||
for (String line : expectedContentSideB.split("\n")) {
|
Collections.addAll(expectedLines, expectedContentSideB.split("\n"));
|
||||||
expectedLines.add(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
assertThat(diff.binary).isNull();
|
assertThat(diff.binary).isNull();
|
||||||
assertThat(diff.changeType).isEqualTo(ChangeType.ADDED);
|
assertThat(diff.changeType).isEqualTo(ChangeType.ADDED);
|
||||||
|
@@ -406,9 +406,7 @@ class Helper {
|
|||||||
throw new IllegalArgumentException("No variables in ldap.groupMemberPattern");
|
throw new IllegalArgumentException("No variables in ldap.groupMemberPattern");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String name : groupMemberQuery.getParameters()) {
|
accountAtts.addAll(groupMemberQuery.getParameters());
|
||||||
accountAtts.add(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
groupMemberQueryList.add(groupMemberQuery);
|
groupMemberQueryList.add(groupMemberQuery);
|
||||||
}
|
}
|
||||||
|
@@ -114,9 +114,7 @@ public class SmtpEmailSender implements EmailSender {
|
|||||||
smtpPass = cfg.getString("sendemail", null, "smtppass");
|
smtpPass = cfg.getString("sendemail", null, "smtppass");
|
||||||
|
|
||||||
Set<String> rcpt = new HashSet<>();
|
Set<String> rcpt = new HashSet<>();
|
||||||
for (String addr : cfg.getStringList("sendemail", null, "allowrcpt")) {
|
Collections.addAll(rcpt, cfg.getStringList("sendemail", null, "allowrcpt"));
|
||||||
rcpt.add(addr);
|
|
||||||
}
|
|
||||||
allowrcpt = Collections.unmodifiableSet(rcpt);
|
allowrcpt = Collections.unmodifiableSet(rcpt);
|
||||||
importance = cfg.getString("sendemail", null, "importance");
|
importance = cfg.getString("sendemail", null, "importance");
|
||||||
expiryDays = cfg.getInt("sendemail", null, "expiryDays", 0);
|
expiryDays = cfg.getInt("sendemail", null, "expiryDays", 0);
|
||||||
|
@@ -53,6 +53,7 @@ import com.google.gerrit.testing.FakeEmailSender.Message;
|
|||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -839,9 +840,7 @@ public class ChangeReviewersIT extends AbstractDaemonTest {
|
|||||||
private static void assertReviewers(
|
private static void assertReviewers(
|
||||||
ChangeInfo c, ReviewerState reviewerState, TestAccount... accounts) throws Exception {
|
ChangeInfo c, ReviewerState reviewerState, TestAccount... accounts) throws Exception {
|
||||||
List<TestAccount> accountList = new ArrayList<>(accounts.length);
|
List<TestAccount> accountList = new ArrayList<>(accounts.length);
|
||||||
for (TestAccount a : accounts) {
|
Collections.addAll(accountList, accounts);
|
||||||
accountList.add(a);
|
|
||||||
}
|
|
||||||
assertReviewers(c, reviewerState, accountList);
|
assertReviewers(c, reviewerState, accountList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user