title: Iterate Map of String and List of integer with not fixed values
body: <p>I have a Map of String and List counts.I want to iterate this and want to set map values in an object.</p>
  <pre><code>    counts.put(&quot;ABC&quot;, Arrays.asList(1,2,3));
      counts.put(&quot;XYZ&quot;, Arrays.asList(1,2));
      counts.put(&quot;PQR&quot;, Arrays.asList(1));
      counts.put(&quot;IJK&quot;, Arrays.asList());
  </code></pre>
  <p>map values are of list type and it can be 1,2,3 etc. or empty but will not exceed 3 in short size can not be more than 2.</p>
  <p>I have written code like below:</p>
  <pre><code>for (Map.Entry&lt;String,List&lt;Integer&gt;&gt; count : counts.entrySet()) {
          InventoryOwnerManagerResult result = new InventoryOwnerManagerResult();
          InventoryOwnerPresence  presence = new InventoryOwnerPresence();
          switch (count.getValue().size()) {
              case 1:
                  presence.setConfigCount(count.getValue().get(0));
                  presence.setWebsitesCount(0);
                  presence.setSourcesCount(0);
                  break;
              case 2:
                  presence.setConfigCount(count.getValue().get(0));
                  presence.setWebsitesCount(count.getValue().get(1));
                  presence.setSourcesCount(0);
                  break;
              case 3:
                  presence.setConfigCount(count.getValue().get(0));
                  presence.setWebsitesCount(count.getValue().get(1));
                  presence.setSourcesCount(count.getValue().get(2));
                  break;
              default:
                  presence.setConfigCount(0);
                  presence.setWebsitesCount(0);
                  presence.setSourcesCount(0);
                  break;
          }
           result.setInventoryOwnerPresence(presence);
      }
  </code></pre>
  <p>This is very old school as well as not an appropriate approach.</p>
  <p>Is there any other way to do this?</p>