From 7b89c437b24915868cab90607d3e2e4c9e7dfd7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=93Key?= <33124734+abcd12315@users.noreply.github.com> Date: Mon, 18 Nov 2019 19:56:06 +0800 Subject: [PATCH] convert HashSet to LinkedHashSet --- .../github/hcsp/collection/RemoveDuplicateCharsInString.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/github/hcsp/collection/RemoveDuplicateCharsInString.java b/src/main/java/com/github/hcsp/collection/RemoveDuplicateCharsInString.java index cae1919..b40283a 100644 --- a/src/main/java/com/github/hcsp/collection/RemoveDuplicateCharsInString.java +++ b/src/main/java/com/github/hcsp/collection/RemoveDuplicateCharsInString.java @@ -8,7 +8,7 @@ public class RemoveDuplicateCharsInString { // 输入ccbbaa返回cba // 输入apple返回aple public static String removeDuplicateCharsInString(String s) { - HashSet charSet = new HashSet<>(); + HashSet charSet = new LinkedHashSet<>(); for (int i = 0; i < s.length(); i++) { charSet.add(s.charAt(i)); }