Skip to content

Commit

Permalink
Remove function duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
lscgh committed Feb 9, 2024
1 parent 03c830a commit 87c39f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ protected static int[] extractIntegerArgs(String args[]) {
return integerArguments;
}

private static ArrayList<String> removeEmptyElementsExceptForLast(String[] list) {
static ArrayList<String> removeEmptyElementsExceptForLast(String[] list) {
ArrayList<String> newList = new ArrayList<String>();
int i = 0;
for(String element: list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public List<String> onTabComplete(CommandSender sender, Command command, String

if(!(sender instanceof Player)) return new ArrayList<String>();

ArrayList<String> argList = CommandTicTacToeAccept.removeMeaninglessElements(args);
ArrayList<String> argList = CommandTicTacToe.removeEmptyElementsExceptForLast(args);

if(argList.size() > CommandTicTacToeAccept.ARG_COUNT) return new ArrayList<String>();

Expand All @@ -91,21 +91,6 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
return filteredCompletions;
}

public static ArrayList<String> removeMeaninglessElements(String[] list) {
ArrayList<String> newList = new ArrayList<String>();

int i = 0;
for(String element: list) {
if(!element.isEmpty() || (i == list.length - 1)) {
newList.add(element);
}

i++;
}

return newList;
}

public static boolean listContainsNonEmptyString(List<String> list) {
for(String string: list) {
if(!string.isEmpty()) return true;
Expand Down

0 comments on commit 87c39f5

Please sign in to comment.