Eee
Eee
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Product product = (Product) o;
return stock == product.stock && Objects.equals(id, product.id) &&
Objects.equals(name, product.name) && Objects.equals(supplier, product.supplier);
}
@Override
public String toString() {
return "Product{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", supplier='" + supplier + '\'' +
", stock=" + stock +
'}';
}
}
public StockManager() {
products = new ArrayList<>();
}
{
if (products.get(i).getSupplier().equals(supplier))
result.add(products.get(i));
}
}
return result;
}
public Product removeProductIFNOStock(String id){
int index= products.indexOf(new Product(id));
if(index!=-1){
Product found =products.get(index);
if(found.getStock()==0){
products.remove(index);
return found;
}
}
return null;
}
public String toString(){
String s="[";
for(int i=0;i< products.size();i++){
s+=products.get(i);
}
return s;
}
}
public MUArrayList() {
capacity = InitialCApacity;
theData = (E[]) new Object[capacity];
}
return s;
}
}
System.out.println("The list:");
myList.AllINDEXof(1);
System.out.println(myList);
myList.AllINDEXof(2);
System.out.println(myList);
myList.addFirstLAst(7);
System.out.println(myList);
}
}