code: public void setAttributes(Map<String, ?> attributes) {
          if (attributes == null) {
              attributes = new HashMap<>();
          }
  
          this.attributes.clear();
          this.attributes.putAll(attributes);
      }
docs: Sets the attribute map.  The specified attributes are copied into the
  underlying map, so modifying the specified attributes parameter after
  the call won't change the internal state.