И так не хочет 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;