title: How would you update the values in a hashmap based on prior conditions?
body: <p>Something fundamental about hashmaps and for loops is hard for me to grasp here. What I'm trying to do is add +1 to the value associated with the key based on the Keys method every time the value within the array list is associated with the key string. </p>
  
  <p>So if there are 3 values in the array list that are positive then the hashmap should have the value with the key "positive" updated to 3.</p>
  
  <p>Any help/advice would be appreciated - thank you.</p>
  
  <pre><code>public String Keys(double input){
  
      if (input &gt; 0){
          System.out.println("positive");
      }
      else if (input &lt; 0) {
          System.out.println("negative");
      }
      else if (input == 0) {
          System.out.println("zero");
      }
      return "";
  }
  
  public HashMap&lt;String, Integer&gt; increaseValues(ArrayList&lt;Double&gt; inputs){
      HashMap&lt;String, Integer&gt; hashMap = new HashMap&lt;&gt;();
      hashMap.put("positive", 0);
      hashMap.put("negative", 0);
      hashMap.put("zero", 0);
  
  //What I tried before adding the Keys method.
  //This updates the value but the loop won't continue if another input in the 
  //arraylist is true.
  
  for (int i = 0; i &lt; inputs.size(); i++){
          double input = inputs.get(i);
  
          if (input &gt; 0){
             hashMap.put("positive", 1);
          } else if (input &lt; 0){
            hashMap.put("negative", 1);
          } else if (input == 0){
            hashMap.put("zero", 1); }
      return hashMap;
  }
  
  public void main(String[] args){
      ArrayList&lt;Double&gt; inputs = new ArrayList&lt;&gt;();
      inputs.add(-4.56);
      inputs.add(-4.66);
      inputs.add(0.0);
      inputs.add(6.0);
      inputs.add(-6.99);
      inputs.add(6.97);   
  }
  </code></pre>