public JsonFields<K, V> build() {
            @SuppressWarnings("unchecked")
            JsonField<K, V>[] fields = new JsonField[node.size()];
            int index = 0;
            for (Map.Entry<K, V> entry : node.entrySet()) {
                fields[index++] = JsonField.of(entry.getKey(), entry.getValue());
            }
            if (comparator != null) {
                Arrays.sort(fields, comparator);
            }
            return new JsonFields<>(fields, nameMapper);
        }
@param nameMapper nameMapper does not guarantee uniqueness.
commons-server/src/main/java/com/navercorp/pinpoint/common/server/util/json/JsonFields.java