/**
* The method "addItem()" receives an item from a
* database. The item has several fields like:
* Reference, Categorie, Name.... and so on.
* I have tried the method with Strings objects instead of
* items and it works, when the
String is not found
* "indexOItem" evaluates to �1 else evalutes to 0.
* But when adding item objects retreived from the
* database, it does not work, "indexOfItem" always
* evaluates to �1 even when I try to add an object
* that already is in the Vector.
* Any ideas? Many thanks in advance
*/
public void addItem(Product newItem){
int indexOfItem = items.indexOf(newItem);
if(indexOfItem == -1){
items.addElement(newItem);
}else{
Producto currentItem = (Product)items.elementAt(indexOfItem);
//more code....
}
}