Skip to content

Commit

Permalink
fix string util join problem
Browse files Browse the repository at this point in the history
fix refreshTask thread start
  • Loading branch information
gh-orange committed Dec 28, 2018
1 parent d1d30f5 commit 5e5aa50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pers/cz/chaoxing/thread/task/TaskModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -141,6 +140,7 @@ void startRefreshTask() {
} catch (InterruptedException ignored) {
}
});
refreshTask.start();
}

void threadPrintln(String first, String... more) {
Expand Down
10 changes: 6 additions & 4 deletions src/pers/cz/chaoxing/util/io/StringUtil.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package pers.cz.chaoxing.util.io;

import com.sun.deploy.util.StringUtils;

import java.util.Arrays;
import java.util.Collection;
import java.util.stream.Collectors;

/**
* @author 橙子
Expand Down Expand Up @@ -72,10 +70,14 @@ public static String join(Collection<?> collection) {
}

public static String join(Object[] array, String s) {
return StringUtils.join(Arrays.stream(array).map(Object::toString).collect(Collectors.toList()), s);
StringBuilder stringBuilder = new StringBuilder();
Arrays.stream(array).map(Object::toString).forEach(str -> stringBuilder.append(str).append(s));
return stringBuilder.toString();
}

public static String join(Collection<?> collection, String s) {
return StringUtils.join(collection.stream().map(Object::toString).collect(Collectors.toList()), s);
StringBuilder stringBuilder = new StringBuilder();
collection.stream().map(Object::toString).forEach(str -> stringBuilder.append(str).append(s));
return stringBuilder.toString();
}
}

0 comments on commit 5e5aa50

Please sign in to comment.