XmlAttributeDescriptor[] (final Map<DAttributePattern, Pair<? extends Map<String, String>, Boolean>> map) { final Map<QName, RngXmlAttributeDescriptor> name2descriptor = new HashMap<>(); for (DAttributePattern pattern : map.keySet()) { final Pair<? extends Map<String, String>, Boolean> value = map.get(pattern); for (QName name : pattern.getName().listNames()) { RngXmlAttributeDescriptor descriptor = name2descriptor.get(name); final RngXmlAttributeDescriptor newDescriptor = new RngXmlAttributeDescriptor(this, pattern, value.first, value.second); if (descriptor == null) { descriptor = newDescriptor; } else { descriptor = descriptor.mergeWith(newDescriptor); } name2descriptor.put(name, descriptor); } } final Collection<RngXmlAttributeDescriptor> result = name2descriptor.values(); return result.toArray(new RngXmlAttributeDescriptor[0]); }