#Feat - Comment als Erklärung

main
Daniel Zikol 2025-12-13 21:52:51 +01:00
parent 2d5e63d6d0
commit b5fa650d8e
1 changed files with 9 additions and 2 deletions

View File

@ -27,7 +27,7 @@ public void addProduct(Product prod, int quantity){
}
}
public void removeProduct(int productID){
CartPosition gettinYETTED = null;
CartPosition gettinYETTED = null; //Pointer ref
for(CartPosition pos : positions){
if(pos.getProduct().getProdID() == productID){
@ -35,7 +35,14 @@ public void removeProduct(int productID){
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){
positions.remove(gettinYETTED);
}