Java List Split split(List list)

Here you can find the source of split(List list)

Description

split

License

Apache License

Declaration

public static List<List<String>> split(List<String> list) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.*;

public class Main {
    public static List<List<String>> split(List<String> list) {
        List<List<String>> lists = new ArrayList<>();
        int lastSplit = 0;
        boolean splited = false;
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).equals("//FILE_SEPARATION_LINE")) {
                lists.add(list.subList(lastSplit, i));
                lastSplit = i + 1;// w  w w . j a v  a 2 s.  c o m
                splited = true;
            }
        }
        if (!splited) {
            lists.add(list);
        }
        return lists;
    }
}

Related

  1. split(final List list, final int index)
  2. split(final List orginalList, final int splitSize)
  3. split(final List original, final int maxListSize, final Class listImplementation)
  4. split(final String line, final char delimiter, final List parts)
  5. split(List data, int max)
  6. split(List list, String separator)
  7. split(List list, String separator)
  8. split(List list)
  9. split(List list, final int parts)