I am new to java and I would really appreciate some suggestions.
I have these 2 classes:
public class Value {
public Integer importance;
public Float price;
public String name;
}
public class Attribute {
public String type;
public String name;
public Value value;
}
Now I have this ArrayList
of Attribute
objects:
ArrayList<Attribute> attributes
What I want is to deep copy elements (not only references) in attributes into this other ArrayList
:
ArrayList<Attribute> newAttributes
I saw that this isn't working:
for(Attribute attribute : atributes) {
newAtributes.add(attribute);
}
What should I do?