Java List Split split(List list, String separator)

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

Description

split

License

Apache License

Declaration

public static Map<String, String> split(List<String> list, String separator) 

Method Source Code


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

import java.util.*;

public class Main {
    public static Map<String, String> split(List<String> list, String separator) {
        if (list == null) {
            return null;
        }//from www.  ja  va 2  s. c o m
        Map<String, String> map = new HashMap<String, String>();
        if (list == null || list.size() == 0) {
            return map;
        }
        for (String item : list) {
            int index = item.indexOf(separator);
            if (index == -1) {
                map.put(item, "");
            } else {
                map.put(item.substring(0, index), item.substring(index + 1));
            }
        }
        return map;
    }
}

Related

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