Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.*;

public class Main {
    public static Map<String, String> toMapOfStrings(final String[] tokens) {
        final Map<String, String> result = new LinkedHashMap<String, String>();
        if (null != tokens) {
            for (String token : tokens) {
                final String[] items = token.split("=");
                final String key;
                final String value;
                if (items.length == 1) {
                    key = items[0].trim();
                    value = "";
                } else if (items.length == 2) {
                    key = items[0].trim();
                    value = items[1].trim();
                } else {
                    continue;
                }
                result.put(key, value);
            }
        }
        return result;
    }
}