Package com.im.commons.util
Class ListSplitters
- java.lang.Object
-
- com.im.commons.util.ListSplitters
-
public final class ListSplitters extends java.lang.Object
Utility for creating ListSplittersByLength.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T extends java.lang.Comparable<?>>
java.lang.Iterable<java.util.List<T>>splitByLength(java.util.List<T> list)
Creates a list splitter that splits the long list into peaces with the maximal length for string representationListSplitterByLength.LENGTH_LIMIT
.static <T extends java.lang.Comparable<?>>
java.lang.Iterable<java.util.List<T>>splitByLength(java.util.List<T> list, int length)
Creates a list splitter that splits the long list into peaces with the maximallength
for string representation.
-
-
-
Method Detail
-
splitByLength
public static <T extends java.lang.Comparable<?>> java.lang.Iterable<java.util.List<T>> splitByLength(java.util.List<T> list)
Creates a list splitter that splits the long list into peaces with the maximal length for string representationListSplitterByLength.LENGTH_LIMIT
. The maximum number of elements in list isListSplitterByLength.IN_LIST_LENGTH_LIMITATION
.- Type Parameters:
T
- The type of elements.- Parameters:
list
- The list to split.- Returns:
- The list split into chunks.
-
splitByLength
public static <T extends java.lang.Comparable<?>> java.lang.Iterable<java.util.List<T>> splitByLength(java.util.List<T> list, int length)
Creates a list splitter that splits the long list into peaces with the maximallength
for string representation. The maximum number of elements in list isListSplitterByLength.IN_LIST_LENGTH_LIMITATION
.- Type Parameters:
T
- The type of elements.- Parameters:
list
- The list to split.length
- The maximal length of list- Returns:
- The list split into chunks with maximum length of
length
-
-