Exemplo n.º 1
0
  @Override
  public JsonValue copy() {
    JsonObject copy = new JsonObject();
    for (Entry<JsonString, JsonValue> v : this.entrySet()) {
      copy.put(v.getKey().asString(), v.getValue().copy());
    }

    return copy;
  }
Exemplo n.º 2
0
  @Override
  public boolean congruent(JsonValue other) {
    if (other == null || other.type() != this.type()) {
      return false;
    }

    JsonObject obj = other.asObject();
    if (obj.size() != this.size()) return false;

    for (Entry<JsonString, JsonValue> entry : this.entrySet()) {
      if (obj.containsKey(entry.getKey())) {
        if (!obj.get(entry.getKey()).congruent(entry.getValue())) return false;
      } else {
        return false;
      }
    }

    return true;
  }