И так не хочет
case "-d":
int id = Integer.parseInt(args[1]);
for (Product p : list) {
if (p.getId() == id) {
int pIndex = list.indexOf(product);
list.remove(pIndex);
}
}
break;
package com.javarush.task.task18.task1828;
public class Product {
private int id;
private String name;
private String price;
private String quantity;
public Product(int id, String name, String price, String quantity) {
this.id = id;
this.name = name;
this.price = price;
this.quantity = quantity;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}
@Override
public String toString() {
return String.format("%-8d%-30s%-8s%-4s", id,name,price,quantity);
}
}