Uploaded image for project: 'Commons Collections'
  1. Commons Collections
  2. COLLECTIONS-393

Split / Partition a collection into smaller collections

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0-alpha1, 4.0
    • Collection
    • None

    Description

      Returns consecutive sublists of a list, each of the same size (the final list may be smaller). For example, partitioning a list containing [a, b, c, d, e] with a partition size of 3 yields [[a, b, c], [d, e]] – an outer list containing two inner lists of three and two elements, all in the original order.

      The outer list is unmodifiable, but reflects the latest state of the source list. The inner lists are sublist views of the original list, produced on demand using List.subList(int, int), and are subject to all the usual caveats about modification as explained in that API. Adapted from http://code.google.com/p/google-collections/

      Inspired by Lars Vogel

      Attachments

        1. TestPartition.java
          2 kB
          Chris Shayan
        2. Partition.java
          2 kB
          Chris Shayan

        Activity

          People

            Unassigned Unassigned
            hamedshayan@gmail.com Chris Shayan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified