boolean (List<? extends TreePath> selectionPaths, List<? extends TreePath> updatedPaths) { if (selectionPaths.size() != updatedPaths.size()) return false; boolean result = false; for (int i = 0; i < selectionPaths.size(); i++) { TreePath selectionPath = selectionPaths.get(i); TreePath updatedPath = updatedPaths.get(i); do { if (updatedPath == null) return false; Object selectedComponent = selectionPath.getLastPathComponent(); Object updatedComponent = updatedPath.getLastPathComponent(); if (selectedComponent != updatedComponent) { if (!selectedComponent.equals(updatedComponent)) return false; result = true; } selectionPath = selectionPath.getParentPath(); updatedPath = updatedPath.getParentPath(); } while (selectionPath != null); if (updatedPath != null) return false; } return result; }