Count a list
Could someone please tell me how to how count status correctly?
I have a large size list and it is broken into a group of smaller lists. I want to show the status when each list is going through the function getNextToSend(). For example, the size of the large list is 105, and it is broken into size 20 for each group. The getNextToSend() method is called 6 times. The first 5 times with 20 list each and the last group size is 5. The simple version of the code is blew. How can I get int generate3 in System.out.println("generate3 is: " + generate3); printed as 1,2.....105. What I got now is it counts from 1 - 20, then it count 1-20. again.
publicclass Counter{
private Vector list;
public HttpSession session;
privateint count = 0;
public Counter(Vector list, HttpServletRequest request){
this.list = list;
this.session = request.getSession();
}
privatesynchronized Profile getNextlToSend(){
if( this.list.size()==0){
returnnull;
}
this.count++;
int generate = Add(this.count++);
session.setAttribute("number" , Integer.toString(generate));
return (Profile)this.list.remove(0);
}
privateint Add(int generate2)
{int generate3 =+ generate2 ;
System.out.println("generate3 is: " + generate3);
return generate3;
}

