#Feat - Comment als Erklärung
parent
2d5e63d6d0
commit
b5fa650d8e
|
|
@ -27,7 +27,7 @@ public void addProduct(Product prod, int quantity){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void removeProduct(int productID){
|
public void removeProduct(int productID){
|
||||||
CartPosition gettinYETTED = null;
|
CartPosition gettinYETTED = null; //Pointer ref
|
||||||
for(CartPosition pos : positions){
|
for(CartPosition pos : positions){
|
||||||
|
|
||||||
if(pos.getProduct().getProdID() == productID){
|
if(pos.getProduct().getProdID() == productID){
|
||||||
|
|
@ -35,7 +35,14 @@ public void removeProduct(int productID){
|
||||||
break; // Gefunden, abbrechnen
|
break; // Gefunden, abbrechnen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
/*
|
||||||
|
Wenn man nach einer ID sucht und diese es nicht gibt, dann passiert nichts
|
||||||
|
weil der Referenz pointer auf NULL zeigt.
|
||||||
|
Wenn ID gefunden wird nach der man sucht dann wird Pointer Referent auf nicht Null
|
||||||
|
dann ----> Call zu delete mit remove aus der List
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
if(gettinYETTED != null){
|
if(gettinYETTED != null){
|
||||||
positions.remove(gettinYETTED);
|
positions.remove(gettinYETTED);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue