title: How to better track Indices in java (vs. Python)
body: <p>In python you can store various types different items in a list, however accessing them must be done through their respective index or a list method.</p>
  
  <p>With python dictionaries you can map keys to items so as to not have to constantly memorize which index has which item.</p>
  
  <p>Python dictionaries are very easy to write:</p>
  
  <pre><code>mydic = {"item1":True, "item2":True, "item3":True}
  </code></pre>
  
  <p>and also easy to acces:</p>
  
  <pre><code>if mydic["item1"]:
      localvar = mydic["item1"]
      mydic["item1"] = False
  </code></pre>
  
  <p>Likewise, in Java I have attempted to do the same thing though I have found it much more complicated:</p>
  
  <pre><code>//this program assumes the creation of a class and method//
  HashMap&lt;String, Boolean&gt; mydic = new HashMap&lt;String, Boolean&gt;();
  mydic.put("item1", false); mydic.put("item2", false); mydic.put("item3", false);
  </code></pre>
  
  <p>and particularly difficult to access:</p>
  
  <pre><code>boolean localvar = mydic.get("item1");
  if (localvar){
      mydic.remove("item1");
      mydic.put("item1", false);
  } else {
      localvar = null;
  }
  </code></pre>
  
  <p>Now I'm not trying to compare languages and if I did, Java would probably win to be honest. It does however seem counter productive to be creating a hashmap of items and values then cast them back into a boolean and then add and remove to change the value to true.</p>
  
  <p>Now in the case of booleans I know there is the option of bitsets but what if the items have say, three possibilities rather than two ie. On/neutral/off?</p>
  
  <p>I considered also the possibility of passing variables around and coordinating with lists
  (it would look like this in python)</p>
  
  <pre><code>item1, item2, item3 = 0, 1, 2
  list = [True, True, True]
  def afunction(item1, item2, item3, itemlist):
      itemlist[item1] = False
  </code></pre>
  
  <p>I'm actually not sure if you can even use the syntax
      itemlist[item1] = False 
  in java. However I am concerned mostly with the memory requirements and doing things the way
  that makes the most sense for java.</p>
  
  <p>Any and all input appreciated,     </p>