I have a for loop, processing two string lists, which invokes a method with multiple parms, returning an object, which gets added to a List
I want to effectively utilize stream/lambda for this, can someone guide me I have two incoming string lists "AAA, BBB, CCC" and a corresponding list of quantities as "1, 3, 11"
final List<someObj> someObjs = new ArrayList<someObj>() ;
final List<String> codesList = Arrays.asList(codes.split("\\s*,\\s*"));
final List<String> qtysList = Arrays.asList(qtys.split("\\s*,\\s*"));
for (String code: codesList){
someObjs.add(addThis(code, qtysList.get(index++)));//
}
return someObj;
How can I convert this using lambdas ? Thanks in advance !