Class CollectionUtils

java.lang.Object
nva.commons.core.CollectionUtils

public final class CollectionUtils extends Object
  • Method Details

    • partition

      public static <T> List<List<T>> partition(List<T> items, int partitionSize)
      Splits a list into consecutive sublists, each of the given size (the last may be smaller). The returned sublists are views of the original list, so changes to the original list will be reflected in the partitions.
      Parameters:
      items - the list to partition
      partitionSize - the maximum size of each partition (must be positive)
      Returns:
      an unmodifiable list of consecutive sublists