title: HashMap return method
body: <p>I have a method in a class, which initialize a HashMap and put some keys and values inside it, then the method returns the HashMap. How can I retrieve the returned HashMap?</p>
  
  <pre><code>public Map&lt;String, String&gt; getSensorValue(String sensorName) {
      registerSensor(sensorName);
      sensorValues.put("x","25");
      sensorValues.put("y","26");
      sensorValues.put("z","27");
      return sensorValues;
  }
  </code></pre>
  
  <p>And here I call this method from another class:</p>
  
  <pre><code>public static HashMap&lt;String, String&gt; sensValues = new HashMap&lt;String, String&gt;();
  
  AllSensors sensVal = new AllSensors();
  sensValues.putAll(sensVal.getSensorValue("orientation"));
  String something = sensValues.get("x");
  </code></pre>
  
  <p>But it does not work in this way</p>
  
  <pre><code>sensValues.putAll(sensVal.getSensorValue("orientation"));
  </code></pre>
  
  <p>Makes my android application crash.
  The point is to retrive returned HashMap somehow.</p>