private static <E,A>boolean equals(TreeDef<E> expectedDef,E expectedRoot,TreeDef<A> actualDef,A actualRoot,BiPredicate<? super E,? super A> compareFunc){
  if (!compareFunc.test(expectedRoot,actualRoot)) {
    return false;
  }
  List<E> expectedChildren=expectedDef.childrenOf(expectedRoot);
  List<A> actualChildren=actualDef.childrenOf(actualRoot);
  if (expectedChildren.size() != actualChildren.size()) {
    return false;
  }
  for (int i=0; i < expectedChildren.size(); ++i) {
    E expectedChild=expectedChildren.get(i);
    A actualChild=actualChildren.get(i);
    if (!equals(expectedDef,expectedChild,actualDef,actualChild,compareFunc)) {
      return false;
    }
  }
  return true;
}

private static < E , A > boolean equals ( TreeDef < E > expectedDef , E expectedRoot , TreeDef < A > actualDef , A actualRoot , BiPredicate < ? super E , ? super A > compareFunc ) { if ( ! compareFunc . test ( expectedRoot , actualRoot ) ) { return false ; } List < E > expectedChildren = expectedDef . childrenOf ( expectedRoot ) ; List < A > actualChildren = actualDef . childrenOf ( actualRoot ) ; if ( expectedChildren . size ( ) != actualChildren . size ( ) ) { return false ; } for ( int i = 0 ; i < expectedChildren . size ( ) ; ++ i ) { E expectedChild = expectedChildren . get ( i ) ; A actualChild = actualChildren . get ( i ) ; if ( ! equals ( expectedDef , expectedChild , actualDef , actualChild , compareFunc ) ) { return false ; } } return true ; }
recursively determines equality between two trees .
