public static HashMap<String,String> parseMap(String s){
  HashMap<String,String> map=New.hashMap();
  for (int i=0, size=s.length(); i < size; ) {
    int startKey=i;
    i=s.indexOf(':',i);
    if (i < 0) {
      throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"Not a map: {0}",s);
    }
    String key=s.substring(startKey,i++);
    StringBuilder buff=new StringBuilder();
    while (i < size) {
      char c=s.charAt(i++);
      if (c == ',') {
        break;
      }
 else       if (c == '\"') {
        while (i < size) {
          c=s.charAt(i++);
          if (c == '\\') {
            if (i == size) {
              throw DataUtils.newIllegalStateException(DataUtils.ERROR_FILE_CORRUPT,"Not a map: {0}",s);
            }
            c=s.charAt(i++);
          }
 else           if (c == '\"') {
            break;
          }
          buff.append(c);
        }
      }
 else {
        buff.append(c);
      }
    }
    map.put(key,buff.toString());
  }
  return map;
}

public static HashMap < String , String > parseMap ( String s ) { HashMap < String , String > map = New . hashMap ( ) ; for ( int i = 0 , size = s . length ( ) ; i < size ; ) { int startKey = i ; i = s . indexOf ( ':' , i ) ; if ( i < 0 ) { throw DataUtils . newIllegalStateException ( DataUtils . ERROR_FILE_CORRUPT , "Not a map: {0}" , s ) ; } String key = s . substring ( startKey , i ++ ) ; StringBuilder buff = new StringBuilder ( ) ; while ( i < size ) { char c = s . charAt ( i ++ ) ; if ( c == ',' ) { break ; } else if ( c == '\"' ) { while ( i < size ) { c = s . charAt ( i ++ ) ; if ( c == '\\' ) { if ( i == size ) { throw DataUtils . newIllegalStateException ( DataUtils . ERROR_FILE_CORRUPT , "Not a map: {0}" , s ) ; } c = s . charAt ( i ++ ) ; } else if ( c == '\"' ) { break ; } buff . append ( c ) ; } } else { buff . append ( c ) ; } } map . put ( key , buff . toString ( ) ) ; } return map ; }
parse a key - value pair list .
