diff --git a/core/src/main/java/hudson/model/LoadBalancer.java b/core/src/main/java/hudson/model/LoadBalancer.java index 37446a181e..22a4b4097c 100644 --- a/core/src/main/java/hudson/model/LoadBalancer.java +++ b/core/src/main/java/hudson/model/LoadBalancer.java @@ -83,11 +83,7 @@ public abstract class LoadBalancer implements ExtensionPoint { // build consistent hash for each work chunk List> hashes = new ArrayList<>(ws.works.size()); for (int i=0; i hash = new ConsistentHash<>(new Hash() { - public String hash(ExecutorChunk node) { - return node.getName(); - } - }); + ConsistentHash 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 chunks = ws.works(i).applicableExecutorChunks(); diff --git a/core/src/main/java/hudson/util/ProcessTree.java b/core/src/main/java/hudson/util/ProcessTree.java index 0b35c67da3..e7bd30cc27 100644 --- a/core/src/main/java/hudson/util/ProcessTree.java +++ b/core/src/main/java/hudson/util/ProcessTree.java @@ -741,11 +741,7 @@ public abstract class ProcessTree implements Iterable, 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; diff --git a/test/src/test/java/jenkins/security/ApiTokenPropertyTest.java b/test/src/test/java/jenkins/security/ApiTokenPropertyTest.java index dd017c7f27..7368140592 100644 --- a/test/src/test/java/jenkins/security/ApiTokenPropertyTest.java +++ b/test/src/test/java/jenkins/security/ApiTokenPropertyTest.java @@ -84,11 +84,7 @@ public class ApiTokenPropertyTest { // test the authentication via Token WebClient wc = createClientForUser("foo"); - assertEquals(u, wc.executeOnServer(new Callable() { - public User call() throws Exception { - return User.current(); - } - })); + assertEquals(u, wc.executeOnServer(User::current)); // Make sure the UI shows the token to the user HtmlPage config = wc.goTo(u.getUrl() + "/configure");