title: java HashMap contains Set as key and arraylist as value
body: <p>Hi I got problem in my code.</p>
  
  <pre><code>String[] vArr = new String[4];
  vArr[0] = "329~abc-2~PACKET_DATA_GATEWAY_IP_ADDRESS~1.2.3.4";
  vArr[1] = "328~abc-1~PACKET_DATA_GATEWAY_IP_ADDRESS~1.1.1.1";
  vArr[2] = "329~abc-2~PACKET_DATA_GATEWAY_PORT_NUMBER~123";
  vArr[3] = "328~abc-1~PACKET_DATA_GATEWAY_PORT_NUMBER~123";
  
  if(vArr != null &amp;&amp; vArr.length &gt; 0) {
      System.out.println("vArr.length ::" + vArr.length);                 
      ArrayList&lt;VehicleTO&gt; aprogList = new ArrayList&lt;VehicleTO&gt;();            
  
      for(int i = 0;i &lt; vArr.length; i++) {
          System.out.println("Inside for loop ::" + vArr.length);
          String[] iData = vArr[i].split("~");
          System.out.println("value retrieved :" + Arrays.toString(iData));
          HashMap&lt;Set, ArrayList&lt;VehicleTO&gt;&gt; programValues = 
                               new HashMap&lt;Set, ArrayList&lt;VehicleTO&gt;&gt;();
  
          String programName = null;
          programName = iData[1];
  
          HashSet&lt;String&gt; listnerOutputArgList = new HashSet&lt;String&gt;();
          listnerOutputArgList.add(programName);
          Collections.unmodifiableSet(listnerOutputArgList);
  
          String progId = null;
          String paramName = null;
          String paramvalue = null;
          progId = iData[0];
          paramName = iData[2];
          paramvalue = iData[3];                  
  
          VehicleTO vehTO = new VehicleTO();                      
          vehTO.setProgramName(programName);
  
          if(paramName.equals("PACKET_DATA_GATEWAY_IP_ADDRESS")) {    
              vehTO.setIpAddress(paramvalue);         
          }
          System.out.println("Setting Values ip ::" + vehTO.getIpAddress());
  
          if(paramName.equals("PACKET_DATA_GATEWAY_PORT_NUMBER")) {   
              vehTO.setPortNumber(paramvalue);                
          }
          System.out.println("Setting Values port ::" + vehTO.getPortNumber());
  
          if(listnerOutputArgList.contains(vehTO.getProgramName())) {
              aprogList.add(vehTO);
          }
          int progDet = aprogList.size();
  
          System.out.println("The list value:"+ progDet);         
  
          programValues.put(listnerOutputArgList,aprogList);
  
          for (Iterator&lt;Set&gt; it = programValues.keySet().iterator(); it.hasNext()) {
              Set key = it.next();
              if(programValues.containsKey(key)) {
                  programValues.get(key).add(vehTO);
                  ArrayList&lt;VehicleTO&gt; value = programValues.get(key);
  
                  for (int nCount = 0; nCount &lt; value.size(); nCount++) {
                           System.out.println((String)value.get(nCount).getIpAddress());
                           System.out.println((String)value.get(nCount).getPortNumber());
                  }
          } 
      }       
  }
  </code></pre>
  
  <p>THe out put need to display as:</p>
  
  <pre><code>abc-1   1.2.3.4  123
  abc-2   1.1.1.1  123
  </code></pre>
  
  <p>But my problem is The list value is showing as: 4 instead of 2 because
  of that out put is wrong.</p>
  
  <p>How to solve this:</p>