private int bsfHashCode(Node node, int result) {
        result += 31 * node.hashCode();

        if(node instanceof Content) {
            return result;
        }

        Element elem = (Element) node;
        List<Node> childElements = elem.getChildElements();

        for (Node childElement : childElements) {
            result += 31 * childElement.hashCode();
        }

        for (Node child : childElements) {
            if (child instanceof Content) {
                result += 31 * child.hashCode();
            } else {
                result = bsfHashCode(child, result);
            }
        }

        return result;
    }
private int bsfHashCode ( Node node , int result ) { result += 31 * node . hashCode ( ) ; if ( node instanceof Content ) { return result ; } Element elem = ( Element ) node ; List < Node > childElements = elem . getChildElements ( ) ; for ( Node childElement : childElements ) { result += 31 * childElement . hashCode ( ) ; } for ( Node child : childElements ) { if ( child instanceof Content ) { result += 31 * child . hashCode ( ) ; } else { result = bsfHashCode ( child , result ) ; } } return result ; }
Recursive hash code creator
@param node root node
@param result cumulative hash code value
@return result resulting cumulative hash code value