Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.hcsp.collection;

import java.util.LinkedHashSet;
import java.util.HashSet;

public class RemoveDuplicateCharsInString {
Expand All @@ -8,7 +9,7 @@ public class RemoveDuplicateCharsInString {
// 输入ccbbaa返回cba
// 输入apple返回aple
public static String removeDuplicateCharsInString(String s) {
HashSet<Character> charSet = new HashSet<>();
HashSet<Character> charSet = new LinkedHashSet<>();
for (int i = 0; i < s.length(); i++) {
charSet.add(s.charAt(i));
}
Expand Down