public static boolean nodeEquals(Node<Integer, String> a,
      Node<Integer, String> b) {

    Deque<Tuple<Node<Integer, String>, Node<Integer, String>>> nodesToVisit
      = new ArrayDeque<Tuple<Node<Integer, String>, Node<Integer, String>>>();

    nodesToVisit.addLast(new Tuple<Node<Integer, String>, Node<Integer, String>>(a,b));

    while(!nodesToVisit.isEmpty()) {

      Tuple<Node<Integer, String>, Node<Integer, String>> visit = nodesToVisit.removeFirst();

      a = visit.getX();
      b = visit.getY();

      if(a == b) {
        continue;
      }

      if (a == null || b == null) {
        return false;
      }

      if (a.isBlack() != b.isBlack()) {
        return false;
      }

      if (!(a.getKey().equals(b.getKey()))) {
        return false;
      }

      if (!(a.getValue().equals(b.getValue()))) {
        return false;
      }

      nodesToVisit.add(new Tuple<Node<Integer,String>, Node<Integer,String>>(a.getLeft(), b.getLeft()));
      nodesToVisit.add(new Tuple<Node<Integer,String>, Node<Integer,String>>(a.getRight(), b.getRight()));

    }

    return true;

  }