private static boolean arePatternsEquivalent(RegExpPattern pattern1, RegExpPattern pattern2) {
    return pattern1 == null ?
           pattern2 == null :
           pattern2 != null && areElementArraysEquivalent(pattern1.getBranches(), pattern2.getBranches(), true);
  }
private static boolean arePatternsEquivalent(RegExpPattern pattern1, RegExpPattern pattern2)