|
@@ -3,9 +3,7 @@ package cn.tonyandmoney.tuon.core.utils;
|
|
|
import cn.tonyandmoney.tuon.core.TuonCoreKt;
|
|
|
import org.springframework.lang.Nullable;
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import static org.springframework.util.StringUtils.deleteAny;
|
|
|
|
|
@@ -15,11 +13,11 @@ import static org.springframework.util.StringUtils.deleteAny;
|
|
|
public class CoreUtils {
|
|
|
|
|
|
|
|
|
- public static List<String> delimitedList(String str) {
|
|
|
+ public static Set<String> delimitedList(String str) {
|
|
|
return delimitedList(str, TuonCoreKt.DELIMITER);
|
|
|
}
|
|
|
|
|
|
- public static List<String> delimitedList(@Nullable String str, @Nullable String delimiter) {
|
|
|
+ public static Set<String> delimitedList(@Nullable String str, @Nullable String delimiter) {
|
|
|
return delimitedList(str, delimiter, null);
|
|
|
}
|
|
|
|
|
@@ -31,15 +29,15 @@ public class CoreUtils {
|
|
|
* @param charsToDelete
|
|
|
* @return
|
|
|
*/
|
|
|
- public static List<String> delimitedList(@Nullable String str, @Nullable String delimiter, @Nullable String charsToDelete) {
|
|
|
+ public static Set<String> delimitedList(@Nullable String str, @Nullable String delimiter, @Nullable String charsToDelete) {
|
|
|
if (str == null) {
|
|
|
- return Collections.emptyList();
|
|
|
+ return Collections.emptySet();
|
|
|
}
|
|
|
if (delimiter == null) {
|
|
|
- return Collections.emptyList();
|
|
|
+ return Collections.emptySet();
|
|
|
}
|
|
|
|
|
|
- List<String> result = new ArrayList<>();
|
|
|
+ Set<String> result = new HashSet<>();
|
|
|
if (delimiter.isEmpty()) {
|
|
|
for (int i = 0; i < str.length(); i++) {
|
|
|
result.add(deleteAny(str.substring(i, i + 1), charsToDelete));
|