code: public static TreePath translatePath(
          TreeModel newTreeModel, TreePath oldPath, 
          BiPredicate<Object, Object> equality)
      {
          Object newRoot = newTreeModel.getRoot();
          List<Object> newPath = new ArrayList<Object>();
          newPath.add(newRoot);
          Object newPreviousElement = newRoot;
          for (int i=1; i<oldPath.getPathCount(); i++)
          {
              Object oldElement = oldPath.getPathComponent(i);
              Object oldUserObject = getUserObjectFromTreeNode(oldElement);
              Object newElement = 
                  getChildWith(newPreviousElement, oldUserObject, equality);
              if (newElement == null)
              {
                  return null;
              }
              newPath.add(newElement);
              newPreviousElement = newElement;
          }
          return new TreePath(newPath.toArray());
      }
docs: Translates one TreePath to a new TreeModel. This methods assumes
  DefaultMutableTreeNodes, and identifies the path based on the
  equality of user objects using the given equality predicate.
  
  @param newTreeModel The new tree model
  @param oldPath The old tree path
  @param equality The equality predicate
  @return The new tree path, or <code>null</code> if there is no
  corresponding path in the new tree model