Inverting a Scrabble letter score map Question:


  The old system stored a list of letters per score:
  
  1 point: "A", "E", "I", "O", "U", "L", "N", "R", "S", "T",
  
  2 points: "D", "G",
  
  3 points: "B", "C", "M", "P",
  
  4 points: "F", "H", "V", "W", "Y",
  
  5 points: "K",
  
  8 points: "J", "X",
  
  10 points: "Q", "Z",
  
  The shiny new scrabble system instead stores the score per letter, which makes it much faster and easier to calculate the score for a word. It also stores the letters in lower-case regardless of the case of the input letters:
  
  "a" is worth 1 point.
  
  "b" is worth 3 points.
  
  "c" is worth 3 points.
  
  "d" is worth 2 points.
  
  Etc.
  
  Your mission, should you choose to accept it, is to write a program that transforms the legacy data format to the shiny new format.


Code:

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

import com.google.inject.AbstractModule;

public class Etl extends AbstractModule {
  public Map transform(Map&lt;Integer, List&lt;String&gt;&gt; oldData) {
    Map&lt;String, Integer&gt; items = new HashMap&lt;String, Integer&gt;();

    for(Map.Entry&lt;Integer, List&lt;String&gt;&gt; entry: oldData.entrySet()) {
      for(String chr: entry.getValue()) {
       items.put(chr.toLowerCase(), entry.getKey()); 
      }
    }
    return items;
  }
}


Can the above code be made more readable and optimized?
The two things I would change:


The Map you're returning should have type parameters.
The key is best to be a Character rather than a String.


Other than that, I don't see much more to it than what you've got there already.