title: Loop through hashmap to create a class instance with inside functions
body: <p>I am making a bukkit plugin, and I am using an API called MCStats, to create the graph, you add Plotters like so...</p>
  
  <pre><code>mobs.addPlotter(new Metrics.Plotter("Player") {
  
      @Override
          public int getValue() {
              return 0;
          }
  
  });
  </code></pre>
  
  <p>But I want to get the values from a HashMap, and idealy something like this...</p>
  
  <pre><code>for(String mob: mobNames) {
      mobs.addPlotter(new Metrics.Plotter(mob) {
  
          @Override
              public int getValue() {
                  return Stats.getValue(mob);
              }
  
      });
  }
  </code></pre>
  
  <p>But obviously, it can't access the mob variable, if I set it to final, it still wont be able to change in the loop. How can I work around this problem?</p>