Package org.opencms.gwt.client.util
Class CmsListSplitter<T extends I_CmsHasSize>
java.lang.Object
org.opencms.gwt.client.util.CmsListSplitter<T>
- Type Parameters:
T
- the type of items in the list to be partitioned
A utility class for partitioning a list of items (each of which has a given size) into one or more batches
of consecutive items such that each batch except the last one consists of just enough items to make the total
sum of item sizes in the batch greater or equal than a given parameter.
- Since:
- 8.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionCmsListSplitter
(List<T> items, int batchSize) Creates a new instance of a list splitter. -
Method Summary
-
Constructor Details
-
CmsListSplitter
Creates a new instance of a list splitter.- Parameters:
items
- the list of items to splitbatchSize
- the minimum size of the batches (except for the last batch)
-
-
Method Details
-
getMore
Gets the next batch of items.This will fail if there are no more items.
- Returns:
- the next batch of items
-
hasMore
Returns true if there are more items left.- Returns:
- true if there are more items left
-