public static < T > String path ( TreeDef . Parented < T > treeDef , T node , Function < ? super T , String > toString , String delimiter ) { List < T > toRoot = toRoot ( treeDef , node ) ; ListIterator < T > iterator = toRoot . listIterator ( toRoot . size ( ) ) ; StringBuilder builder = new StringBuilder ( ) ; while ( iterator . hasPrevious ( ) ) { T segment = iterator . previous ( ) ; // add the node builder . append ( toString . apply ( segment ) ) ; // add the separator if it makes sense if ( iterator . hasPrevious ( ) ) { builder . append ( delimiter ) ; } } return builder . toString ( ) ; }
Returns the path of the given node .