Object ListUtilities.Companion
-
- All Implemented Interfaces:
public class ListUtilities.Companion
-
-
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.- Parameters:
listToEncapsulate- The String List of which to encapsulate every element in.- Returns:
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:
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.- Parameters:
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.
- Parameters:
list- The list to print to the console.chunkSize- The chunk size to print the list with.prefix- A prefix to add to each line printed to the console.printIndexes- Whether to print the indexes of the entries.
-
printListToLogChunked
final Unit printListToLogChunked(List<String> list, Integer chunkSize, String prefix, Boolean printIndexes)
Print a list to our log at info level, 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.
- Parameters:
list- The list to print to the console.chunkSize- The chunk size to print the list with.prefix- A prefix to add to each line printed to the console.printIndexes- Whether to print the indexes of the entries.
-
-
-
-