@Test public void test_equivalence_for_empty_tree_list() throws Exception { ArgumentListTree tree1 = parse("f() ;", Tree.Kind.ARGUMENT_LIST); ArgumentListTree tree2 = parse("f() ;", Tree.Kind.ARGUMENT_LIST); assertThat(SyntacticEquivalence.areEquivalent(tree1.arguments(), tree1.arguments())).isFalse(); assertThat(SyntacticEquivalence.areEquivalent(tree1.arguments(), tree2.arguments())).isFalse(); }
public static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList) { if (leftList.size() != rightList.size() || leftList.isEmpty()) { return false; } for (int i = 0; i < leftList.size(); i++) { Tree left = leftList.get(i); Tree right = rightList.get(i); if (!areEquivalent(left, right)) { return false; } } return true; }
SyntacticEquivalence { public static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList) { if (leftList.size() != rightList.size() || leftList.isEmpty()) { return false; } for (int i = 0; i < leftList.size(); i++) { Tree left = leftList.get(i); Tree right = rightList.get(i); if (!areEquivalent(left, right)) { return false; } } return true; } }
SyntacticEquivalence { public static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList) { if (leftList.size() != rightList.size() || leftList.isEmpty()) { return false; } for (int i = 0; i < leftList.size(); i++) { Tree left = leftList.get(i); Tree right = rightList.get(i); if (!areEquivalent(left, right)) { return false; } } return true; } private  SyntacticEquivalence(); }
SyntacticEquivalence { public static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList) { if (leftList.size() != rightList.size() || leftList.isEmpty()) { return false; } for (int i = 0; i < leftList.size(); i++) { Tree left = leftList.get(i); Tree right = rightList.get(i); if (!areEquivalent(left, right)) { return false; } } return true; } private  SyntacticEquivalence(); static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList); static boolean areEquivalent(@Nullable Tree leftNode, @Nullable Tree rightNode); }
SyntacticEquivalence { public static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList) { if (leftList.size() != rightList.size() || leftList.isEmpty()) { return false; } for (int i = 0; i < leftList.size(); i++) { Tree left = leftList.get(i); Tree right = rightList.get(i); if (!areEquivalent(left, right)) { return false; } } return true; } private  SyntacticEquivalence(); static boolean areEquivalent(List<? extends Tree> leftList, List<? extends Tree> rightList); static boolean areEquivalent(@Nullable Tree leftNode, @Nullable Tree rightNode);  }