mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2025-02-13 17:01:21 +01:00
Optimize StringUtil
This commit is contained in:
parent
6e9824e6b0
commit
58a14bc508
@ -3,11 +3,7 @@ package com.Acrobot.Breeze.Utils;
|
||||
import org.apache.commons.lang.WordUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Acrobot
|
||||
@ -45,7 +41,7 @@ public class StringUtil {
|
||||
* @return Joined array
|
||||
*/
|
||||
public static String joinArray(String[] array) {
|
||||
return joinArray(Arrays.asList(array));
|
||||
return String.join(" ", array);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,7 +51,7 @@ public class StringUtil {
|
||||
* @return Joined iterable
|
||||
*/
|
||||
public static String joinArray(Collection<String> array) {
|
||||
return array.stream().collect(Collectors.joining(" "));
|
||||
return String.join(" ", array);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,12 +69,12 @@ public class StringUtil {
|
||||
* @return Stripped strings
|
||||
*/
|
||||
public static String[] stripColourCodes(String[] strings) {
|
||||
List<String> output = new ArrayList<String>();
|
||||
String[] output = new String[strings.length];
|
||||
|
||||
for (String string : strings) {
|
||||
output.add(stripColourCodes(string));
|
||||
for (int i = 0; i < strings.length; i++) {
|
||||
output[i] = stripColourCodes(strings[i]);
|
||||
}
|
||||
|
||||
return output.toArray(new String[output.size()]);
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user