title: HashMap using streams and substring
body: <p>I am wondering how to achieve the following.</p>
  
  <blockquote>
    <p>"t12345-g1234-o1234"</p>
  </blockquote>
  
  <p>I have a line that contains multiple fields delimited by an hyphen and the field is formed by its identifier(first letter) and value.</p>
  
  <p>How can I achieve an Map like the one below using java 8 streams.</p>
  
  <blockquote>
    <p>{"t","12345"} , {"g","1234"}, {"o","1234"}</p>
  </blockquote>
  
  <p>EDIT</p>
  
  <p>I have tried the following, but I don't understand how to grab the substring information.</p>
  
  <pre><code>Arrays.stream(line.split("-"))
  .collect(Collectors.toMap(String::substring(0,1),String::substring(1));
  </code></pre>