|
> From: albartell
>
>
> Integer total1 = new Integer(0);
> Integer total2 = new Integer(0);
> Integer total3 = new Integer(0);
> Integer total4 = new Integer(0);
> Integer total5 = new Integer(0);
> Iterator iter = myList.iterator();
> while (iter.hasNext()) {
> total1 = new Integer(0);
> total2 = new Integer(0);
> total3 = new Integer(0);
> total4 = new Integer(0);
> total5 = new Integer(0);
>
> total1 = methodTotal1();
> total1 = methodTotal1();
> total1 = methodTotal1();
> total1 = methodTotal1();
> total1 = methodTotal1();
> // write totals to PDF
> }
I don't understand. What is this supposed to emulate? The only thing
being done here is:
total1 = methodTotal1();
// write to PDF
What is all the other stuff supposed to represent? If you meant to be
doing this:
total2 = methodTotal2();
total3 = methodTotal3();
total4 = methodTotal4();
total5 = methodTotal5();
Then the code should be thus:
Integer total1 = methodTotal1();
(...)
Integer total5 = methodTotal5();
// write to PDF
You shouldn't be creating the original Integer(0) objects, since they're
all thrown away. Personally, though, I might write a method writeTotals
which accepts the five Integer objects, and do this:
writeTotals(
methodTotal1(), methodTotal2(), methodTotal3(),
methodTotal4(), methodTotal5());
Joe
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.