Java String to Map stringToMap(final String s)

Here you can find the source of stringToMap(final String s)

Description

string To Map

License

Apache License

Declaration

public static Map<String, String> stringToMap(final String s) 

Method Source Code

//package com.java2s;
// Licensed to the Apache Software Foundation (ASF) under one

import java.util.HashMap;

import java.util.Map;

public class Main {
    public static Map<String, String> stringToMap(final String s) {
        final Map<String, String> map = new HashMap<String, String>();
        final String[] elements = s.split(";");
        for (final String parts : elements) {
            final String[] keyValue = parts.split(":");
            map.put(keyValue[0], keyValue[1]);
        }//from   w ww.  j  ava 2  s .  c  o  m
        return map;
    }
}

Related

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