HBASE-19682 Use Collections.emptyList() For Empty List Values

This commit is contained in:
Beluga Behr 2018-10-18 09:56:20 -04:00 committed by Michael Stack
parent 6bdaedd7ce
commit 21b98e1075
4 changed files with 9 additions and 6 deletions

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.master.balancer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
@ -75,7 +76,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
protected static final int MIN_SERVER_BALANCE = 2;
private volatile boolean stopped = false;
private static final List<RegionInfo> EMPTY_REGION_LIST = new ArrayList<>(0);
private static final List<RegionInfo> EMPTY_REGION_LIST = Collections.emptyList();
static final Predicate<ServerMetrics> IDLE_SERVER_PREDICATOR
= load -> load.getRegionMetrics().isEmpty();

View File

@ -18,7 +18,7 @@
package org.apache.hadoop.hbase.regionserver;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.UUID;
@ -57,7 +57,7 @@ implements RowProcessor<S,T> {
@Override
public List<UUID> getClusterIds() {
return new ArrayList<>();
return Collections.emptyList();
}
@Override

View File

@ -996,7 +996,9 @@ public class StripeStoreFileManager
@Override
public List<byte[]> getStripeBoundaries() {
if (this.state.stripeFiles.isEmpty()) return new ArrayList<>();
if (this.state.stripeFiles.isEmpty()) {
return Collections.emptyList();
}
ArrayList<byte[]> result = new ArrayList<>(this.state.stripeEndRows.length + 2);
result.add(OPEN_KEY);
Collections.addAll(result, this.state.stripeEndRows);

View File

@ -1034,7 +1034,7 @@ public abstract class FSUtils extends CommonFSUtils {
// assumes we are in a table dir.
List<FileStatus> rds = listStatusWithStatusFilter(fs, tableDir, new RegionDirFilter(fs));
if (rds == null) {
return new ArrayList<>();
return Collections.emptyList();
}
List<Path> regionDirs = new ArrayList<>(rds.size());
for (FileStatus rdfs: rds) {
@ -1101,7 +1101,7 @@ public abstract class FSUtils extends CommonFSUtils {
public static List<Path> getReferenceFilePaths(final FileSystem fs, final Path familyDir) throws IOException {
List<FileStatus> fds = listStatusWithStatusFilter(fs, familyDir, new ReferenceFileFilter(fs));
if (fds == null) {
return new ArrayList<>();
return Collections.emptyList();
}
List<Path> referenceFiles = new ArrayList<>(fds.size());
for (FileStatus fdfs: fds) {