title: Java get List of maps of maps from config.yml
body: <p>I'm trying to create a plugin where I'm storing some Minecraft items' data along with some properties.</p>
  
  <p>This is my YAML file's content:</p>
  
  <pre><code>rates:
  - 391:
      mul: 10000
      store: 5000
  - 392:
      mul: 9000
      store: 5000
  </code></pre>
  
  <p>So it's basically a list of maps of maps(I think so at least).
  This is my JAVA code where I'm trying to access the key 'mul' of '391':</p>
  
  <pre><code>List&lt;Map&lt;?,?&gt;&gt; rates;
  rates= getConfig().getMapList("rates");
  for(Map&lt;?,?&gt; mp : rates){
      Map &lt;?,?&gt; test = (Map&lt;?,?&gt;) mp.get("" + item);
      player.sendMessage(test.toString());// HERE I get null pointer exception, and the following lines if this line wasn't there in the first place
      player.sendMessage("Mul is: " + test.get("mul"));
      player.sendMessage("Store is: " + test.get("store"));
  }
  </code></pre>
  
  <p>As per suggested answer, here is my test code, where I still get NullPointerException:  </p>
  
  <pre><code>import java.io.FileNotFoundException;
  import java.io.FileReader;
  import java.util.Map;
  
  import net.sourceforge.yamlbeans.YamlException;
  import net.sourceforge.yamlbeans.YamlReader;
  
  public class Test {
  
  public static void main(String[] args) throws FileNotFoundException, YamlException{
      YamlReader reader = new YamlReader(new FileReader("config.yml"));
      Map map = (Map) reader.read();
      Map itemMap = (Map) map.get("391");
      System.out.println(itemMap.get("mul"));//This is where I get the exception now
      System.out.println(itemMap.get("store"));
  }
  }
  </code></pre>