if (o == null) { throw new IllegalArgumentException ("null child"); }  if (!(o instanceof Element)) { throw new IllegalArgumentException ("not an element"); }  Element child = (Element) o; Object key = child.getElementKey();  if (key == null) { throw new IllegalArgumentException ("null key"); }
Object key = check(o); Element child = (Element) o;
    public boolean add(Object o) {        if (o == null) {            throw new IllegalArgumentException                ("null child");        }        if (!(o instanceof Element)) {            throw new IllegalArgumentException                ("not an element");        }        Element child = (Element) o;        Object key = child.getElementKey();        if (key == null) {            throw new IllegalArgumentException                ("null key");        }        if (child.getParent() != null) {            throw new IllegalArgumentException                ("child is already contained");        }        if (m_childrenMap.containsKey(key)) {            throw new IllegalArgumentException                ("duplicate key");        }        m_children.add(child);        m_childrenMap.put(key, child);        child.setParent(m_parent);        return true;    }