mapping question
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Robert_Taylor
Posted On:   Monday, September 18, 2006 09:06 PM

I have a question about the mapping for my dataMap method, it works but it adds a new time control and flag ever iteration I need the data to go through this iteration, so I can get all the values,but I don't want the identical values being added to the dataMap hashtable. Any suggestions? here is my code Thanks List dList = new Vector(); List dpList = new Vector(); Vector procID = null; for (Iterator iter = getFirewallEntries().iterator(); iter.hasNext();) { PolicyFirewallEntries fw = (PolicyFirewallEntries)iter.next(); if (fw.getTimeCtrl() == null || fw.getFlags() == null) { continue; } Map dataMap = new Hashtable(); dataMap.put(TIMECTRL, fw.getTimeCtrlId(   More>>

I have a question about the mapping for my dataMap method, it works but it adds a new time control and flag ever iteration I need the data to go through this iteration, so I can get all the values,but I don't want the identical values being added to the dataMap hashtable. Any suggestions?
here is my code
Thanks

			
List dList = new Vector();
List dpList = new Vector();
Vector procID = null;
for (Iterator iter = getFirewallEntries().iterator(); iter.hasNext();) {
PolicyFirewallEntries fw = (PolicyFirewallEntries)iter.next();
if (fw.getTimeCtrl() == null || fw.getFlags() == null) {
continue;
}
Map dataMap = new Hashtable();
dataMap.put(TIMECTRL, fw.getTimeCtrlId());
dataMap.put(FLAGS, fw.getConnFlags());
dList.add(dataMap);

if (procID == null) {
procID = CwModelUtil.generateVec(fw.getProcId());
} else {
procID.add(fw.getProcId());
}
}
Map procMap = new Hashtable();
procMap.put(KNOWNRULES, CwModelUtil.safePut(new Hashtable(), DATA, procVec));
depsList.add(procMap);
Map map = new Hashtable();
map.put(DATA, dList);
map.put(DPS, dpList);
return map;
   <<Less

Re: mapping question

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, October 9, 2006 02:30 PM

Are you saying you don't want more than one occurence of a single value, among the Map entries? even if they are for different keys?



You could just check, before putting the new entry, if there's already an entry with that value in the Map.
About | Sitemap | Contact