Procházet zdrojové kódy

lambda优化,微调代码间距

miemie před 7 roky
rodič
revize
b5f74bef31

+ 0 - 3
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/ObjectUtils.java

@@ -14,7 +14,6 @@ import java.util.Map;
  */
 public class ObjectUtils {
 
-
     /**
      * 判断object是否为空,集合会校验size
      */
@@ -27,7 +26,6 @@ public class ObjectUtils {
         return false;
     }
 
-
     /**
      * 判断object是否不为空,集合会校验size
      */
@@ -65,5 +63,4 @@ public class ObjectUtils {
         // else
         return false;
     }
-
 }

+ 5 - 18
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/toolkit/SystemClock.java

@@ -18,7 +18,6 @@ package com.baomidou.mybatisplus.core.toolkit;
 import java.sql.Timestamp;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -63,22 +62,12 @@ public class SystemClock {
     }
 
     private void scheduleClockUpdating() {
-        ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
-
-            @Override
-            public Thread newThread(Runnable runnable) {
-                Thread thread = new Thread(runnable, "System Clock");
-                thread.setDaemon(true);
-                return thread;
-            }
+        ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(runnable -> {
+            Thread thread = new Thread(runnable, "System Clock");
+            thread.setDaemon(true);
+            return thread;
         });
-        scheduler.scheduleAtFixedRate(new Runnable() {
-
-            @Override
-            public void run() {
-                now.set(System.currentTimeMillis());
-            }
-        }, period, period, TimeUnit.MILLISECONDS);
+        scheduler.scheduleAtFixedRate(() -> now.set(System.currentTimeMillis()), period, period, TimeUnit.MILLISECONDS);
     }
 
     private long currentTimeMillis() {
@@ -86,8 +75,6 @@ public class SystemClock {
     }
 
     private static class InstanceHolder {
-
         public static final SystemClock INSTANCE = new SystemClock(1);
     }
-
 }