Created
June 30, 2022 15:29
-
-
Save dreadwarrior/3a4c1a8e6bbb3f55179bb7e08a7e3433 to your computer and use it in GitHub Desktop.
Java Kata: Optional, Stream and List operations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ArrayList<String> list = new ArrayList<>(); | |
String configs = params.getConfigurationIds(); // TODO: CSV list payload | |
if (configs != null && !configs.trim().isEmpty()) { // TODO: compare with call to StringValidator.isEmptyString() at line 5 | |
// split the list and put all items into the list | |
if (!StringValidator.isEmptyString(configs)) { // TODO: method body like: string == null || string.trim().isEmpty() | |
String[] feld = configs.split(","); | |
if (feld != null) { | |
if (feld.length > 0) { | |
for (String dummy : feld) { | |
String tmp = dummy.trim(); | |
if (tmp.length() > 0) { | |
list.add(tmp); | |
} | |
} | |
} else { // no comma | |
list.add(configs); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment