The below data is an in memory collection as java ArrayList
, from this collection the need is to filter the data based on the combination of two fields (VRNT_CD and ITM_NB)
VRNT_CD ITM_NB COMMT_TEXT
10 A0A SampleText1
10 A0A SampleText2
10 A0A SampleText3
10 A0B SampleText4
10 A0C SampleText5
20 A0A SampleText6
20 A0A SampleText7
20 A0B SampleText8
20 A0C SampleText9
30 A0A SampleText10
30 A0A SampleText11
30 AOB SampleText12
30 A0C SampleText13
30 A0C SampleText14
As mentioned above, each row in the above table is mapped to a below java object
public class SummaryDataOracle {
private String funcCode;
private String commentText;
private String variantCd;
private String itemNB;
//setters //getters
}
The collection of the above table represents as List<SummaryDataOracle>
, a map needs to be generated using the collection object based on the below key
public class VssKey {
private String funCode;
private String varntCode;
private String itemNb;
//setters //getters // equals // hashcode
}
so the resultant collection should have the below data structure
AOA 10 SampleText1
SampleText2
SampleText3
20 SampleText6
SampleText7
30 SampleText10
SampleText11
AOB 10 SampleText4
20 SampleText8
30 SampleText12
AOC 10 SampleText5
20 SampleText9
30 SampleText13
SampleText14