Ok, I don't know why but I am thinking I am missing something very basic to solve this. Here is my problem: I have a method createPublisherRequestObject(String str) which takes string argument and returns a List of ReportRequest Object. Normally for a given String 65 objects will be created. I have another method getTimeFrameValues() which returns arraylist of string. Normally this method would return around 15 strings in arraylist. So basically I would be iterating in loop for 15 times (Num of String) and then for each iteration, I will be calling method createPublisherRequestObject to create 65 objects. At the end of this I wanted to have a list of 65*15 objects. Here is my code -
ArrayList<String> timeList = er.getTimeFrameValues();
List<ReportRequest> reqList = new ArrayList<>();
for (Iterator iterator = timeList.iterator(); iterator.hasNext();) {
String string = (String) iterator.next();
reqList = rj.createPublisherRequestObject(string);
}
log.info("Final List Size "+reqList.size());
But this returns 65
Please help!!!
Thanks, pratik
for ( String string : timeList )? By the way, string is such a bad variable name...