Re: Java collections



tim@xxxxxxxxxxxxx wrote:
I've create a small program that loops through a database table and
adds columns of the retrieved row to a collection.
For some reason, the Collection.add statement seems to be changing all
of the data to the contents of the last row processed.
Any Idea what would cause this? I am running it through the debug mode
of Eclipse and can see it happen during the add statement.

Here is a snippet of the code.

while (rset.next()) {

Customer Cust = new Customer();

Cust.setCUST_NUMBER(rset.getInt(1));
Cust.setLAST_NAME(rset.getString(2));
Cust.setFIRST_NAME(rset.getString(3));
Cust.setSEX(rset.getString(4));
Cust.setCITY(rset.getString(5));
CustomerCollection.add(Cust);
}

.