Fix more cases where Collection.isEmpty() should be used
Change-Id: I9c8465445373179f928f33e57dae83c9027b7a9f
This commit is contained in:
@@ -69,7 +69,7 @@ public class Section {
|
|||||||
all.addAll(Arrays.asList(flags.cfg.getStringList(section, subsection, name)));
|
all.addAll(Arrays.asList(flags.cfg.getStringList(section, subsection, name)));
|
||||||
|
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
if (all.size() == 0 || all.size() == 1) {
|
if (all.isEmpty() || all.size() == 1) {
|
||||||
flags.cfg.setString(section, subsection, name, value);
|
flags.cfg.setString(section, subsection, name, value);
|
||||||
} else {
|
} else {
|
||||||
all.set(0, value);
|
all.set(0, value);
|
||||||
@@ -78,7 +78,7 @@ public class Section {
|
|||||||
|
|
||||||
} else if (all.size() == 1) {
|
} else if (all.size() == 1) {
|
||||||
flags.cfg.unset(section, subsection, name);
|
flags.cfg.unset(section, subsection, name);
|
||||||
} else if (all.size() != 0) {
|
} else if (!all.isEmpty()) {
|
||||||
all.remove(0);
|
all.remove(0);
|
||||||
flags.cfg.setStringList(section, subsection, name, all);
|
flags.cfg.setStringList(section, subsection, name, all);
|
||||||
}
|
}
|
||||||
|
@@ -167,7 +167,7 @@ public class GroupCollector {
|
|||||||
checkState(!done, "visit() called after getGroups()");
|
checkState(!done, "visit() called after getGroups()");
|
||||||
Set<RevCommit> interestingParents = getInterestingParents(c);
|
Set<RevCommit> interestingParents = getInterestingParents(c);
|
||||||
|
|
||||||
if (interestingParents.size() == 0) {
|
if (interestingParents.isEmpty()) {
|
||||||
// All parents are uninteresting: treat this commit as the root of a new
|
// All parents are uninteresting: treat this commit as the root of a new
|
||||||
// group of related changes.
|
// group of related changes.
|
||||||
groups.put(c, c.name());
|
groups.put(c, c.name());
|
||||||
|
@@ -2159,7 +2159,7 @@ class ReceiveCommits {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes.size() == 0) {
|
if (changes.isEmpty()) {
|
||||||
if (!isValidChangeId(p.changeKey.get())) {
|
if (!isValidChangeId(p.changeKey.get())) {
|
||||||
reject(magicBranch.cmd, "invalid Change-Id");
|
reject(magicBranch.cmd, "invalid Change-Id");
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@@ -72,7 +72,7 @@ public class DeleteExternalIds implements RestModifyView<AccountResource, List<S
|
|||||||
permissionBackend.currentUser().check(GlobalPermission.ACCESS_DATABASE);
|
permissionBackend.currentUser().check(GlobalPermission.ACCESS_DATABASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extIds == null || extIds.size() == 0) {
|
if (extIds == null || extIds.isEmpty()) {
|
||||||
throw new BadRequestException("external IDs are required");
|
throw new BadRequestException("external IDs are required");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -238,7 +238,7 @@ public class ReviewerRecommender {
|
|||||||
// (weighted 10d), number of comments (weighted 0.5d) and number of owned
|
// (weighted 10d), number of comments (weighted 0.5d) and number of owned
|
||||||
// changes (weighted 1d).
|
// changes (weighted 1d).
|
||||||
Map<Account.Id, MutableDouble> reviewers = new LinkedHashMap<>();
|
Map<Account.Id, MutableDouble> reviewers = new LinkedHashMap<>();
|
||||||
if (candidates.size() == 0) {
|
if (candidates.isEmpty()) {
|
||||||
return reviewers;
|
return reviewers;
|
||||||
}
|
}
|
||||||
List<Predicate<ChangeData>> predicates = new ArrayList<>();
|
List<Predicate<ChangeData>> predicates = new ArrayList<>();
|
||||||
|
Reference in New Issue
Block a user