From 8aa483ce6628cefd7db4e5ed3d69ef5d4470d52d Mon Sep 17 00:00:00 2001 From: Looly Date: Tue, 11 Feb 2020 16:58:34 +0800 Subject: [PATCH] fix comment --- CHANGELOG.md | 2 ++ .../cn/hutool/core/collection/CollUtil.java | 2 +- .../cn/hutool/core/collection/IterUtil.java | 4 ++-- .../java/cn/hutool/core/date/StopWatch.java | 21 ++----------------- 4 files changed, 7 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 247e8e4c8..a06b21f75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,11 @@ ### 新特性 * 【core 】 废弃isMactchRegex,改为isMatchRegex(方法错别字) +* 【core 】 修正hasNull()方法上注释错误(issue#I18TAG@Gitee) ### Bug修复 * 【core 】 CharsetUtil在不支持GBK的系统中运行报错问题(issue#731@Github) * 【core 】 RandomUtil的randomEleSet方法顺序不随机的问题(pr#741@Github) +* 【core 】 修复StopWatch的toString判断问题(issue#I18VIK@Gitee) ------------------------------------------------------------------------------------------------------------- diff --git a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java b/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java index df23352d4..9df7e0919 100644 --- a/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java @@ -1474,7 +1474,7 @@ public class CollUtil { /** * 是否包含{@code null}元素 * - * @param iterable 被检查的Iterable对象,如果为{@code null} 返回false + * @param iterable 被检查的Iterable对象,如果为{@code null} 返回true * @return 是否包含{@code null}元素 * @see IterUtil#hasNull(Iterable) * @since 3.0.7 diff --git a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java b/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java index c5177f314..9de7ce377 100644 --- a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java @@ -60,7 +60,7 @@ public class IterUtil { /** * 是否包含{@code null}元素 * - * @param iter 被检查的{@link Iterable}对象,如果为{@code null} 返回false + * @param iter 被检查的{@link Iterable}对象,如果为{@code null} 返回true * @return 是否包含{@code null}元素 */ public static boolean hasNull(Iterable iter) { @@ -70,7 +70,7 @@ public class IterUtil { /** * 是否包含{@code null}元素 * - * @param iter 被检查的{@link Iterator}对象,如果为{@code null} 返回false + * @param iter 被检查的{@link Iterator}对象,如果为{@code null} 返回true * @return 是否包含{@code null}元素 */ public static boolean hasNull(Iterator iter) { diff --git a/hutool-core/src/main/java/cn/hutool/core/date/StopWatch.java b/hutool-core/src/main/java/cn/hutool/core/date/StopWatch.java index a3c7bdbac..73b0be074 100755 --- a/hutool-core/src/main/java/cn/hutool/core/date/StopWatch.java +++ b/hutool-core/src/main/java/cn/hutool/core/date/StopWatch.java @@ -6,7 +6,6 @@ import cn.hutool.core.util.StrUtil; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.TimeUnit; /** * 秒表封装
@@ -69,11 +68,6 @@ public class StopWatch { * 总运行时间 */ private long totalTimeNanos; - /** - * 时间单位(支持三种单位:纳秒、毫秒、秒) - */ - private TimeUnit timeUnit = TimeUnit.NANOSECONDS; - // ------------------------------------------------------------------------------------------- Constructor start /** @@ -131,17 +125,6 @@ public class StopWatch { } } - /** - * 设置时间单位,不设置默认是纳秒 - * - * @param timeUnit 时间单位 - * @author 李显锋 - * @since 5.1.1 - */ - public void setTimeUnit(TimeUnit timeUnit) { - this.timeUnit = timeUnit; - } - /** * 开始默认的新任务 * @@ -354,8 +337,8 @@ public class StopWatch { @Override public String toString() { final StringBuilder sb = new StringBuilder(shortSummary()); - if (null == this.taskList) { - for (TaskInfo task : getTaskInfo()) { + if (null != this.taskList) { + for (TaskInfo task : this.taskList) { sb.append("; [").append(task.getTaskName()).append("] took ").append(task.getTimeNanos()).append(" ns"); long percent = Math.round(100.0 * task.getTimeNanos() / getTotalTimeNanos()); sb.append(" = ").append(percent).append("%");