Replace anonymous types with method references

This commit is contained in:
Basil Crow committed 2020-12-19 12:17:39 -08:00
1 parent ee24685ca3
commit 406cefcd73
3 files changed
+3 -15

No files matched your search

@@ -83,11 +83,7 @@ public abstract class LoadBalancer implements ExtensionPoint {
// build consistent hash for each work chunk
List<ConsistentHash<ExecutorChunk>> hashes = new ArrayList<>(ws.works.size());
for (int i=0; i<ws.works.size(); i++) {
ConsistentHash<ExecutorChunk> hash = new ConsistentHash<>(new Hash<ExecutorChunk>() {
public String hash(ExecutorChunk node) {
return node.getName();
}
});
ConsistentHash<ExecutorChunk> hash = new ConsistentHash<>(ExecutorChunk::getName);
// Build a Map to pass in rather than repeatedly calling hash.add() because each call does lots of expensive work
List<ExecutorChunk> chunks = ws.works(i).applicableExecutorChunks();
@@ -741,11 +741,7 @@ public abstract class ProcessTree implements Iterable<OSProcess>, IProcessTree,
ProcfsUnix(boolean vetoersExist) {
super(vetoersExist);
File[] processes = new File("/proc").listFiles(new FileFilter() {
public boolean accept(File f) {
return f.isDirectory();
}
});
File[] processes = new File("/proc").listFiles(File::isDirectory);
if(processes==null) {
LOGGER.info("No /proc");
return;