protected <T extends Node> T cloneTo(final T dest) {
//		dest.nodeValue = nodeValue;		// already  in clone implementations!
		dest.parentNode = parentNode;

		if (attributes != null) {
			dest.attributes = new ArrayList<>(attributes.size());
			for (int i = 0, attributesSize = attributes.size(); i < attributesSize; i++) {
				Attribute attr = attributes.get(i);
				dest.attributes.add(attr.clone());
			}
		}

		if (childNodes != null) {
			dest.childNodes = new ArrayList<>(childNodes.size());
			for (int i = 0, childNodesSize = childNodes.size(); i < childNodesSize; i++) {
				Node child = childNodes.get(i);
				Node childClone = child.clone();

				childClone.parentNode = dest;    // fix parent!
				dest.childNodes.add(childClone);
			}
		}

		return dest;
	}
protected < T extends Node > T cloneTo ( final T dest ) { dest . parentNode = parentNode ; if ( attributes != null ) { dest . attributes = new ArrayList < > ( attributes . size ( ) ) ; for ( int i = 0 , attributesSize = attributes . size ( ) ; i < attributesSize ; i ++ ) { Attribute attr = attributes . get ( i ) ; dest . attributes . add ( attr . clone ( ) ) ; } } if ( childNodes != null ) { dest . childNodes = new ArrayList < > ( childNodes . size ( ) ) ; for ( int i = 0 , childNodesSize = childNodes . size ( ) ; i < childNodesSize ; i ++ ) { Node child = childNodes . get ( i ) ; Node childClone = child . clone ( ) ; childClone . parentNode = dest ; dest . childNodes . add ( childClone ) ; } } return dest ; }
Copies all non-final values to the empty cloned object.
Cache-related values are not copied.