Node < E > function ( Node < E > arg0 ) { if ( arg0 . parent != arg0 ) { arg0 . parent = findRoot ( arg0 . parent ) ; } return arg0 . parent ; }
given a node , walk the parent field as far as possible , until reaching the root , which is the node for the currentrepresentative of this equivalence class . to achieve low runtime complexity , also compress the path , by making each node a direct child of the root . concode_field_sep Node<E> parent concode_elem_sep Map<E,Node<E>> elmap concode_elem_sep int size concode_elem_sep long serialVersionUID concode_elem_sep int rank concode_elem_sep E element concode_field_sep void add concode_elem_sep E find concode_elem_sep boolean areEquivalent concode_elem_sep Set<E> elements concode_elem_sep E union concode_elem_sep Set<E> findAll concode_elem_sep Collection<Set<E>> allEquivalenceClasses concode_elem_sep Node<E> findRootOrCreateNode