Merge "ReceiveCommits: Make use of Iterables.getLast to get the last element of a list"
This commit is contained in:
@@ -967,7 +967,7 @@ class ReceiveCommits {
|
|||||||
if (!noteDbValues.isEmpty()) {
|
if (!noteDbValues.isEmpty()) {
|
||||||
// These semantics for duplicates/errors are somewhat arbitrary and may not match e.g. the
|
// These semantics for duplicates/errors are somewhat arbitrary and may not match e.g. the
|
||||||
// CmdLineParser behavior used by MagicBranchInput.
|
// CmdLineParser behavior used by MagicBranchInput.
|
||||||
String value = noteDbValues.get(noteDbValues.size() - 1);
|
String value = Iterables.getLast(noteDbValues);
|
||||||
noteDbPushOption = NoteDbPushOption.parse(value);
|
noteDbPushOption = NoteDbPushOption.parse(value);
|
||||||
if (!noteDbPushOption.isPresent()) {
|
if (!noteDbPushOption.isPresent()) {
|
||||||
addError("Invalid value in -o " + NoteDbPushOption.OPTION_NAME + "=" + value);
|
addError("Invalid value in -o " + NoteDbPushOption.OPTION_NAME + "=" + value);
|
||||||
@@ -978,8 +978,7 @@ class ReceiveCommits {
|
|||||||
|
|
||||||
List<String> traceValues = pushOptions.get("trace");
|
List<String> traceValues = pushOptions.get("trace");
|
||||||
if (!traceValues.isEmpty()) {
|
if (!traceValues.isEmpty()) {
|
||||||
String value = traceValues.get(traceValues.size() - 1);
|
tracePushOption = Optional.of(Iterables.getLast(traceValues));
|
||||||
tracePushOption = Optional.of(value);
|
|
||||||
} else {
|
} else {
|
||||||
tracePushOption = Optional.empty();
|
tracePushOption = Optional.empty();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user