我正在一个项目中,我正在从SearchMatch类获取ROW_ID,并且正在迭代这些记录并将其存储在HashMap对象中,因为有多个ROW_ID对象具有不同的值,所以现在我必须检查它们是否相同还是不检查那里的频率。请告知逻辑
SearchMatchResponse smResponse =(SearchMatchResponse)oSiperianClient.process(searchRequest);
ArrayList<Record> records = smResponse.getRecords();
Iterator<Record> recordIter = null;
int i = 1;
int count =0;
Map<String, Object> searchMap = new HashMap<>();
for (recordIter = records.iterator(); recordIter.hasNext();) {
CleanseData.writeStringLog("Counting Record : " + i);
i++;
Record record = (Record) recordIter.next();
Collection<Field> fields = record.getFields();
searchMap.put("ROWID_OBJECT",record.getField("ROWID_OBJECT").getValue());
searchMap.put("CUST_NM", record.getField("CUST_NM").getValue());
searchMap.put("ADDR_LN1", record.getField("ADDR_LN1").getValue());
-------
--
so On--
}
我试图将计数放入for循环中,但没有成功
count = Collections.frequency(searchMap.values(), searchMap.get("ROWID_OBJECT") );
System.out.println("Count is:"+ count++);