匿名类替换为lambda表达式

This commit is contained in:
liuhuan
2020-01-03 09:46:03 +08:00
parent d77b8d43bf
commit decd6a1460
11 changed files with 76 additions and 151 deletions

View File

@@ -1,12 +1,12 @@
package cn.hutool.cache.impl;
import cn.hutool.cache.GlobalPruneTimer;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import cn.hutool.cache.GlobalPruneTimer;
/**
* 定时缓存<br>
* 此缓存没有容量限制,对象只有在过期后才会被移除
@@ -72,12 +72,7 @@ public class TimedCache<K, V> extends AbstractCache<K, V> {
* @param delay 间隔时长,单位毫秒
*/
public void schedulePrune(long delay) {
this.pruneJobFuture = GlobalPruneTimer.INSTANCE.schedule(new Runnable() {
@Override
public void run() {
prune();
}
}, delay);
this.pruneJobFuture = GlobalPruneTimer.INSTANCE.schedule(this::prune, delay);
}
/**