Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Attributes;
- import java.util.ArrayList;
- import java.util.List;
- /**
- * Created by Carl on 2/24/2017.
- */
- public class Product {
- final String name;
- List<Attribute> attributeGroup;
- public Product(String name) {
- this.name = name;
- attributeGroup = new ArrayList<>();
- }
- public Product(String name, Attribute attr) {
- this(name);
- attributeGroup.add(attr);
- }
- public Product(String name, List<Attribute> attributes) {
- this(name);
- this.attributeGroup = attributes;
- }
- @Override
- public String toString() {
- StringBuilder str = new StringBuilder();
- str.append("[Product " + name + " Attributes");
- attributeGroup.forEach(a -> str.append(a.toString()));
- str.append("]");
- return str.toString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement