public static StringValueMap fromString ( String line ) { StringValueMap result = new StringValueMap ( ) ; if ( line == null || line . length ( ) == 0 ) return result ; // Todo: User tokenizer / decoder String [ ] tokens = line . split ( ";" , - 1 ) ; for ( String token : tokens ) { if ( token . length ( ) == 0 ) continue ; int index = token . indexOf ( ' ' ) ; String key = index > 0 ? token . substring ( 0 , index ) . trim ( ) : token . trim ( ) ; String val = index > 0 ? token . substring ( index + 1 ) . trim ( ) : null ; result . put ( key , val ) ; } return result ; }
Parses semicolon - separated key - value pairs and returns them as a StringValueMap .