title: Reversing a HashMap from Map<String, Boolean> to Map<Boolean, List<String>>
body: <p>Is there a more elegant/built-in way to reverse the keys and values of a Hashmap?</p>
  
  <p>I currently have the following.</p>
  
  <pre><code>private Map&lt;Boolean, List&lt;String&gt;&gt; reverseMap(Map&lt;String, Boolean&gt; permissions) {
      List&lt;String&gt; allow = new ArrayList&lt;String&gt;();
      List&lt;String&gt; deny = new ArrayList&lt;String&gt;();
      Map&lt;Boolean, List&lt;String&gt;&gt; returnvalue = new HashMap&lt;Boolean, List&lt;String&gt;&gt;();
  
      for (Entry&lt;String, Boolean&gt; entry : permissions.entrySet()) {
          if(entry.getValue()) {
              allow.add(entry.getKey());
          } else {
              deny.add(entry.getKey());
          }
      }
  
      returnvalue.put(true, allow);
      returnvalue.put(false, deny);
      return returnvalue;
  }
  </code></pre>