Module Core, clss Product : Ajout constructeur de copie + modif méthode de copie du contenu (utilisation des streams)

This commit is contained in:
Notmoo 2017-07-30 13:27:09 +02:00
parent 79d531273a
commit 0b8bb4e183

View File

@ -33,10 +33,14 @@ public class Product implements ILoggable, Serializable{
this.category = category; this.category = category;
this.components = new ArrayList<>(); this.components = new ArrayList<>();
if(components!=null){ if(components!=null){
this.components.addAll(components); components.stream().forEach(p->this.components.add(new Product(p)));
} }
} }
public Product(Product p) {
this(p.id, p.name, p.amountRemaining, p.amountSold, p.sellable, p.price, p.components, p.category);
}
public long getId() { public long getId() {
return id; return id;
} }