public boolean equals()

in src/main/java/com/google/firebase/database/snapshot/ChildrenNode.java [326:357]


  public boolean equals(Object otherObj) {
    if (otherObj == null) {
      return false;
    }
    if (otherObj == this) {
      return true;
    }
    if (!(otherObj instanceof ChildrenNode)) {
      return false;
    }
    ChildrenNode other = (ChildrenNode) otherObj;
    if (!this.getPriority().equals(other.getPriority())) {
      return false;
    } else if (this.children.size() != other.children.size()) {
      return false;
    } else {
      Iterator<Map.Entry<ChildKey, Node>> thisIterator = this.children.iterator();
      Iterator<Map.Entry<ChildKey, Node>> otherIterator = other.children.iterator();
      while (thisIterator.hasNext() && otherIterator.hasNext()) {
        Map.Entry<ChildKey, Node> thisNameNode = thisIterator.next();
        Map.Entry<ChildKey, Node> otherNamedNode = otherIterator.next();
        if (!thisNameNode.getKey().equals(otherNamedNode.getKey())
            || !thisNameNode.getValue().equals(otherNamedNode.getValue())) {
          return false;
        }
      }
      if (thisIterator.hasNext() || otherIterator.hasNext()) {
        throw new IllegalStateException("Something went wrong internally.");
      }
      return true;
    }
  }