From 9e620b80213ad06c9d62d5ab6b3c00c43231802d Mon Sep 17 00:00:00 2001 From: NanCheung Date: Mon, 3 Feb 2020 02:38:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9ARandomUtil=E7=9A=84r?= =?UTF-8?q?andomEleSet=E6=96=B9=E6=B3=95=E5=9C=A8=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E6=97=A0=E6=B3=95=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java b/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java index 0505546c7..33dfd05c8 100644 --- a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java @@ -8,7 +8,7 @@ import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collection; import java.util.Date; -import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Random; import java.util.Set; @@ -366,7 +366,7 @@ public class RandomUtil { throw new IllegalArgumentException("Count is larger than collection distinct size !"); } - final HashSet result = new HashSet<>(count); + final Set result = new LinkedHashSet<>(count); int limit = source.size(); while (result.size() < count) { result.add(randomEle(source, limit));