HBASE-19682 Use Collections.emptyList() For Empty List Values
This commit is contained in:
parent
b9c9f1d61f
commit
3d3dd04651
|
@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.master.balancer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Deque;
|
import java.util.Deque;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -75,7 +76,7 @@ public abstract class BaseLoadBalancer implements LoadBalancer {
|
||||||
protected static final int MIN_SERVER_BALANCE = 2;
|
protected static final int MIN_SERVER_BALANCE = 2;
|
||||||
private volatile boolean stopped = false;
|
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
|
static final Predicate<ServerMetrics> IDLE_SERVER_PREDICATOR
|
||||||
= load -> load.getRegionMetrics().isEmpty();
|
= load -> load.getRegionMetrics().isEmpty();
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package org.apache.hadoop.hbase.regionserver;
|
package org.apache.hadoop.hbase.regionserver;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -57,7 +57,7 @@ implements RowProcessor<S,T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<UUID> getClusterIds() {
|
public List<UUID> getClusterIds() {
|
||||||
return new ArrayList<>();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -996,7 +996,9 @@ public class StripeStoreFileManager
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<byte[]> getStripeBoundaries() {
|
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);
|
ArrayList<byte[]> result = new ArrayList<>(this.state.stripeEndRows.length + 2);
|
||||||
result.add(OPEN_KEY);
|
result.add(OPEN_KEY);
|
||||||
Collections.addAll(result, this.state.stripeEndRows);
|
Collections.addAll(result, this.state.stripeEndRows);
|
||||||
|
|
|
@ -1020,7 +1020,7 @@ public abstract class FSUtils extends CommonFSUtils {
|
||||||
// assumes we are in a table dir.
|
// assumes we are in a table dir.
|
||||||
List<FileStatus> rds = listStatusWithStatusFilter(fs, tableDir, new RegionDirFilter(fs));
|
List<FileStatus> rds = listStatusWithStatusFilter(fs, tableDir, new RegionDirFilter(fs));
|
||||||
if (rds == null) {
|
if (rds == null) {
|
||||||
return new ArrayList<>();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<Path> regionDirs = new ArrayList<>(rds.size());
|
List<Path> regionDirs = new ArrayList<>(rds.size());
|
||||||
for (FileStatus rdfs: rds) {
|
for (FileStatus rdfs: rds) {
|
||||||
|
@ -1087,7 +1087,7 @@ public abstract class FSUtils extends CommonFSUtils {
|
||||||
public static List<Path> getReferenceFilePaths(final FileSystem fs, final Path familyDir) throws IOException {
|
public static List<Path> getReferenceFilePaths(final FileSystem fs, final Path familyDir) throws IOException {
|
||||||
List<FileStatus> fds = listStatusWithStatusFilter(fs, familyDir, new ReferenceFileFilter(fs));
|
List<FileStatus> fds = listStatusWithStatusFilter(fs, familyDir, new ReferenceFileFilter(fs));
|
||||||
if (fds == null) {
|
if (fds == null) {
|
||||||
return new ArrayList<>();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
List<Path> referenceFiles = new ArrayList<>(fds.size());
|
List<Path> referenceFiles = new ArrayList<>(fds.size());
|
||||||
for (FileStatus fdfs: fds) {
|
for (FileStatus fdfs: fds) {
|
||||||
|
|
Loading…
Reference in New Issue