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