For example:
Public Class SomeClass{
private String value1;
private String value2;
private String value3;
private Double value4;
//getters & setters of above
}
Consider the input ArrayList
of Object
(SomeClass):
Object has variables of type String,String,String
and double
`List<SomeClass> inputList = [{a,b,c,32.14},{d,e,f,47.50},{g,h,i,60.23}{j,k,l,47.69},{d,e,f,15.56},{a,b,c,25.41}];`
Consider 2 objects in inputList : {a,b,c,32.14},{a,b,c,25.41}
If variables of object {a,b,c,32.14} String,String,String
.equals(String,String,String) of other objects {a,b,c,25.41}
just sum their double value and convert it into single object {a,b,c,57.55}
.
As a result of above I would like to have result in some ArrayList of object:
List<SomeClass> outputList = [{a,b,c,57.55},{d,e,f,62.66},{g,h,i,60.23},{j,k,l,47.69}];
Please let me know the logic to implement the above scenario?Nested for loop will be fine