/** * Deep copies the attribute map, by creating clones (using copy * constructors) of the attributes. * * @param attributes The attribute map to copy. * @return The copied map. */ private Map<String, Attribute> deepCopyAttributeMap( Map<String, Attribute> attributes) { Map<String, Attribute> retValue = new HashMap<String, Attribute>(attributes.size()); for (Map.Entry<String, Attribute> entry : attributes.entrySet()) { Attribute toCopy = entry.getValue(); if (toCopy != null) { retValue.put(entry.getKey(), toCopy.clone()); } } return retValue; } }
/** * Deep copies the attribute map, by creating clones (using copy * constructors) of the attributes. * * @param attributes The attribute map to copy. * @return The copied map. */ private Map<String, Attribute> deepCopyAttributeMap( Map<String, Attribute> attributes) { Map<String, Attribute> retValue = new HashMap<String, Attribute>(attributes.size()); for (Map.Entry<String, Attribute> entry : attributes.entrySet()) { Attribute toCopy = entry.getValue(); if (toCopy != null) { retValue.put(entry.getKey(), toCopy.clone()); } } return retValue; } }
/** * Copy constructor. * * @param toCopy The list attribute to copy. * @since 2.1.3 */ public ListAttribute(ListAttribute toCopy) { super(toCopy); List<Attribute> attributesToCopy = toCopy.getValue(); if (attributesToCopy != null) { List<Attribute> attributes = new ArrayList<Attribute>(attributesToCopy.size()); for (Attribute attribute : attributesToCopy) { if (attribute != null) { attributes.add(attribute.clone()); } else { attributes.add(null); } } setValue(attributes); } this.inherit = toCopy.inherit; }