public static Map<String, Map<String, String>> transformAttributesMap(Map<String, Map<String, String>> input) {
    return input.entrySet().stream()
      .flatMap(outer -> outer.getValue().entrySet().stream().map(inner -> Triple.of(outer.getKey(), inner.getKey(), inner.getValue())))
      .collect(groupingBy(Triple::getMiddle, toMap(Triple::getLeft, Triple::getRight)));
  }
Transform attibutes map from <i>attributeName -> propertyName -> value</i> to <i>propertyName -> attributeName -> value</i>
or vice versa
@param input the input map
@return the output map
ambari-server/src/main/java/org/apache/ambari/server/topology/ConfigurableHelper.java