Class StringCollectionUtil
java.lang.Object
ch.tocco.nice2.toolbox.api.string.StringCollectionUtil
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringcutOnMaxSizeAndJoinStrings(Collection<String> collectionToJoin, String moreThanMaxElementsMessage) joins all elements of the collection using a line break.static <T> StringcutOnMaxSizeAndJoinStrings(Collection<T> collectionToJoin, Function<T, String> transformerFunction, String moreThanMaxElementsMessage) behaves the same way ascutOnMaxSizeAndJoinStrings(Collection, String)except that it accepts any type ofCollectionwhich will be transformed to a stringCollectionusing the giventransformerFunction.static StringjoinOnLineBreaks(Iterable<String> strings) static StringjoinOnLineBreaks(String... strings) 
- 
Method Details- 
cutOnMaxSizeAndJoinStringspublic static String cutOnMaxSizeAndJoinStrings(Collection<String> collectionToJoin, String moreThanMaxElementsMessage) joins all elements of the collection using a line break. if there are more elements incollectionToJointhan defined inmaxSize, the list will be shortened to a size ofMAX_SIZEand the message inmoreThanMaxElementsMessagewill be appended at the end. Note: use the placeholder %s inmoreThanMaxElementsMessageif you want to include the number of skipped records in the message- Parameters:
- collectionToJoin- the strings to join
- moreThanMaxElementsMessage- the message to append when the collection is bigger than- maxSize
 
- 
cutOnMaxSizeAndJoinStringspublic static <T> String cutOnMaxSizeAndJoinStrings(Collection<T> collectionToJoin, Function<T, String> transformerFunction, String moreThanMaxElementsMessage) behaves the same way ascutOnMaxSizeAndJoinStrings(Collection, String)except that it accepts any type ofCollectionwhich will be transformed to a stringCollectionusing the giventransformerFunction. Using this method probably results in a better performance than transforming theCollectionyourself because it will be shortened, if necessary, before the transformation- Parameters:
- collectionToJoin- the strings to join
- transformerFunction- a function which must return a- String
- moreThanMaxElementsMessage- the message to append when the collection is bigger than- maxSize
 
- 
joinOnLineBreaks
- 
joinOnLineBreaks
 
-