Object ListUtilities.Companion
-
- All Implemented Interfaces:
public class ListUtilities.CompanionCleanup helpers for the list-valued properties, which arrive as delimited strings.
-
-
Field Summary
Fields Modifier and Type Field Description public final static ListUtilities.CompanionINSTANCE
-
Method Summary
Modifier and Type Method Description final StringencapsulateListElements(List<String> listToEncapsulate)Encapsulate every element of the passed String List in quotes. final List<String>readStringList()Prompts the user to enter the values which will make up a String List in the new configuration file. final List<String>cleanList(List<String> listToCleanUp)Clean a given String List of any entry consisting only of whitespace or a length of 0.final UnitprintListToConsoleChunked(List<String> list, Integer chunkSize, String prefix, Boolean printIndexes)Print a list to console in chunks. final UnitprintListToLogChunked(List<String> list, Integer chunkSize, String prefix, Boolean printIndexes)Print a list to our log at info level, in chunks. -
-
Method Detail
-
encapsulateListElements
final String encapsulateListElements(List<String> listToEncapsulate)
Encapsulate every element of the passed String List in quotes. Returns the list as
["element1","element2","element3"etc.Returns a concatenated String with all elements of the passed list encapsulated.
-
readStringList
final List<String> readStringList()
Prompts the user to enter the values which will make up a String List in the new configuration file. If the user enters an empty line, the method is exited and the String List returned.
Returns the list of values entered by the user.
-
cleanList
final List<String> cleanList(List<String> listToCleanUp)
Clean a given String List of any entry consisting only of whitespace or a length of
0.listToCleanUp — The list from which to delete all entries consisting only of whitespace or with a length of zero. Returns returns the cleaned up list.
-
printListToConsoleChunked
final Unit printListToConsoleChunked(List<String> list, Integer chunkSize, String prefix, Boolean printIndexes)
Print a list to console in chunks. If a chunk size of 5 is set for a list with 20 entries, the result would be 4 lines printed, with 5 entries each.
-
-
-
-