Skip to content

Commit

Permalink
Merge pull request #7 from Inder00/patch-1
Browse files Browse the repository at this point in the history
Use Java's stream collectors function map
  • Loading branch information
arthurr0 authored Nov 6, 2021
2 parents 43af0cb + 69aee57 commit 1bf77f4
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/main/java/pl/minecodes/mineeconomy/util/MessageUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Collections;
import java.util.stream.Collectors;

public class MessageUtil {

Expand Down Expand Up @@ -42,14 +43,8 @@ public static String implementColors(String message) {
}

public static List<String> implementColors(List<String> message) {
if (message == null || message.isEmpty()) {
return Collections.emptyList();
}

//TODO 06/11/2021: Naprawić syf kod
List<String> messages = new ArrayList<>();
message.forEach(s -> messages.add(implementColors(s)));
return messages;
if (message == null || message.isEmpty()) return Collections.emptyList();
return message.stream().map(msg -> implementColors(msg)).collect(Collectors.toList());
}

public static String removeColor(String message) {
Expand Down

0 comments on commit 1bf77f4

Please sign in to comment.