Java String to Map stringToMap(String append)

Here you can find the source of stringToMap(String append)

Description

string To Map

License

Open Source License

Declaration

public static Map stringToMap(String append) 

Method Source Code

//package com.java2s;
/*//from   w  w w. j  ava2 s. c  om
 * Copyright (C) 2016 larryTheHarry 
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.ArrayList;
import java.util.Arrays;

import java.util.HashMap;
import java.util.Map;

public class Main {
    public static Map stringToMap(String append) {
        if (append.isEmpty()) {
            return new HashMap<>();
        }
        HashMap errs = new HashMap<>();
        String[] at = append.split(", ");
        for (String string : at) {
            String[] at2 = string.split(":");
            ArrayList<String> atd = new ArrayList<>();
            atd.addAll(Arrays.asList(at2));
            errs.put(atd.get(0), atd.get(1));
        }
        return errs;
    }
}

Related

  1. stringToCharMap(String s)
  2. stringToMap(final String s)
  3. stringToMap(final String s)
  4. stringToMap(String source, String delimiter)
  5. stringToMap(String src)
  6. stringToMap(String src)
  7. StringToMap(String str)