Code example for Vector

Methods: add, remove

0
 
public class XMLNode implements Iterable<XMLNode> {
 
    private String mName;
    private XMLNode mParent;
    private Vector<XMLNode> mChildren = new Vector<XMLNode>();
    private HashMap<String, String> mAttrs = new HashMap<String, String>();
 
    public XMLNode(String name) {
        mName = name;
    } 
 
    public void add(XMLNode child) {
        if (child.mParent != null) {
            child.mParent.remove(child);
        } 
        child.mParent = this;
        mChildren.add(child);
    } 
 
    public void remove(XMLNode child) {
        if (child.mParent == this) {
            mChildren.remove(child);
            child.mParent = null;
        } 
    } 
 
    public String getName() {