I need your help in java code such as how can I get unique records from an arraylist which is multidimensional array of casting a class of Value objects(setters and getters).
I'm reading a table and putting all records in an ararylist of arraylist. "table" will have entire table per say 3 columns 25 rows in which some material numbers are unique and some are duplicated. I wanted to get rid of duplicate material number rows and ONLY get unique material number of rows.
ArrayList<EssVO> recordInstance = new ArrayList<EssVO>();
EssVO ESSvorecord = new EssVO();
for (int i = 0; i < table.getNumRows(); i++){
table.setRow(i);
ESSvorecord = new EssVO();
ESSvorecord.setCONTRACT_NUMBER(table.getString("CONTRACT_NUMBER"));
ESSvorecord.setCONTRACT_LINE_ITEM(table.getString("CONTRACT_LINE_ITEM"));
ESSvorecord.setMATERIAL_NUMBER(table.getString("MATERIAL_NUMBER"));
recordInstance.add(ESSvorecord);
}
//Display
Iterator<EssVO> itrForSubs = recordInstance.iterator();
while(itrForSubs.hasNext()){
ESSvorecord = itrForSubs.next();
ESSvorecord.getCONTRACT_NUMBER();
ESSvorecord.getCONTRACT_LINE_ITEM();
ESSvorecord.getMATERIAL_NUMBER();
}
Appreciate of your input and help.
Thanks Raj