Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    public static Map splitAll(Map list, String separator) {
        if (list == null)
            return null;
        Map result = new HashMap();
        java.util.Map.Entry entry;
        for (Iterator i$ = list.entrySet().iterator(); i$.hasNext(); result.put(entry.getKey(),
                split((List) entry.getValue(), separator)))
            entry = (java.util.Map.Entry) i$.next();

        return result;
    }

    public static Map split(List list, String separator) {
        if (list == null)
            return null;
        Map map = new HashMap();
        if (list == null || list.size() == 0)
            return map;
        for (Iterator i$ = list.iterator(); i$.hasNext();) {
            String item = (String) i$.next();
            int index = item.indexOf(separator);
            if (index == -1)
                map.put(item, "");
            else
                map.put(item.substring(0, index), item.substring(index + 1));
        }

        return map;
    }
}