Skip to content

Commit

Permalink
testing: minor lint-suggested improvements (#9259)
Browse files Browse the repository at this point in the history
Use for-each and Lists.reverse() instead of classic for
  • Loading branch information
sergiitk authored Jun 10, 2022
1 parent 9cebe0a commit a4a67b7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions testing/src/main/java/io/grpc/testing/GrpcCleanupRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Stopwatch;
import com.google.common.base.Ticker;
import com.google.common.collect.Lists;
import io.grpc.ExperimentalApi;
import io.grpc.ManagedChannel;
import io.grpc.Server;
Expand Down Expand Up @@ -170,8 +171,8 @@ protected void after() {

InterruptedException interrupted = null;
if (!abruptShutdown) {
for (int i = resources.size() - 1; i >= 0; i--) {
resources.get(i).cleanUp();
for (Resource resource : Lists.reverse(resources)) {
resource.cleanUp();
}

for (int i = resources.size() - 1; i >= 0; i--) {
Expand All @@ -190,8 +191,8 @@ protected void after() {
}

if (!resources.isEmpty()) {
for (int i = resources.size() - 1; i >= 0; i--) {
resources.get(i).forceCleanUp();
for (Resource resource : Lists.reverse(resources)) {
resource.forceCleanUp();
}

try {
Expand Down

0 comments on commit a4a67b7

Please sign in to comment.