Removes duplicate attribute names.
@param attributes The {@link List} of {@link XsdAttribute} objects.
@return The distinct {@link List} of {@link XsdAttribute}.
330230
private static List<XsdAttribute> filterAttributes(List<XsdAttribute> attributes) {
        List<String> attributeNames = attributes.stream()
                .map(XsdNamedElements::getName)
                .distinct()
                .collect(Collectors.toList());

        List<XsdAttribute> filteredAttributes = new ArrayList<>();

        attributeNames.forEach(attributeName -> {
            for (XsdAttribute attribute : attributes) {
                if (attribute.getName().equals(attributeName)){
                    filteredAttributes.add(attribute);
                    break;
                }
            }
        });

        return filteredAttributes;
    }
764242
public String[] getAttributeNames()
    {
        Set      keys   = (attributeMap == null ? new HashSet() : attributeMap.keySet());
        String[] result = new String[keys.size()];

        keys.toArray(result);
        return result;
    }
901966
public static Iterable<String> getAttributeNames(Iterable<Attribute> attrs) {
    return () -> stream(attrs).map(Attribute::getName).iterator();
  }
374134
private void extractAttributes(String attributes)
	{
		String s = attributes.trim();
		if (s.length() > 0 && s.charAt(s.length() - 1) == '/')
			elem.setEmptyElementTag(true);

		while (s.length() != 0) {
			final int equal = s.indexOf('=');
			if (equal == -1 || equal == s.length() - 1)
				break;
			// cut off attribute name
			final String att = s.substring(0, equal).trim();
			s = s.substring(equal + 1).trim();
			if (s.length() == 0)
				break;
			final boolean quote = s.charAt(0) == '\'' || s.charAt(0) == '\"';
			if (att.length() > 0 && quote) {
				String value = s.substring(1);
				final int end = value.indexOf(s.charAt(0));
				if (end >= 0)
					value = value.substring(0, end);
				elem
					.addAttribute(new Attribute(att, References.replace(value, false)));
			}
			final int i = s.indexOf(quote ? s.charAt(0) : ' ', 1);
			s = i == -1 ? "" : s.substring(i + 1);
		}
	}
689020
protected function _cleanAttributes($attributes)
    {
        foreach ($attributes as $key => $value) {
            if (is_int($key) || in_array($key, $this->_config['ignored'])) {
                unset($attributes[$key]);
            } else if ($key != 'memberof' && is_array($value) && count($value) == 1) {
                $attributes[$key] = $value[0];
            }
        }

        return $attributes;
    }
330243
public ThingAttribute withAttributes(java.util.Map<String, String> attributes) {
        setAttributes(attributes);
        return this;
    }
955081
public LDAPQuery setAttributes(List<String> attributes) {
		if(attributes != null && attributes.size() > 0) {
			this.attributes = new String[attributes.size()];
			int i = 0;
			for(String attribute : attributes) {
				this.attributes[i++] = attribute;
			}
		} else {
			this.attributes = ALL_ATTRIBUTES;
		}
		return this;
	}
511328
public final void setAttributes(final Map<String, Attribute> attributes) {
        for (Map.Entry<String, Attribute> entry: attributes.entrySet()) {
            Object attribute = entry.getValue();
            if (!(attribute instanceof Attribute)) {
                final String msg =
                        "Attribute: '" + entry.getKey() + "' is not an attribute. It is a: " + attribute;
                LOGGER.error("Error setting the Attributes: {}", msg);
                throw new IllegalArgumentException(msg);
            } else {
                ((Attribute) attribute).setConfigName(entry.getKey());
            }
        }
        this.attributes = attributes;
    }
510862
@SuppressWarnings("unchecked")
    public String[] getAttributeNames() {

        List<String> names = new ArrayList<String>();
        Enumeration<String> keys = attributes.keys();
        while (keys.hasMoreElements()) {
            names.add((String) keys.nextElement());
        }
        String results[] = new String[names.size()];
        for (int i = 0; i < results.length; i++) {
            results[i] = (String) names.get(i);
        }
        return (results);

    }
1044773
public Global excludedAttributes(String... attributes){
		
		for (String attribute : attributes)
			global.excluded.add(new XmlExcludedAttribute(attribute));
		
		return this;
	}
872496
public void setAttributes( final String... attributes )
    {
        this.attributes = attributes == null ? null : new HashSet<String>( Arrays.asList( attributes ) );
    }
236306
public static String toAttributeString(Set<String> attributes) {
    List<String> list = new ArrayList<String>(attributes);
    Collections.sort(list, ATTRIBUTES_COMPARATOR);
    return Joiner.on(", ").join(list);
  }
460239
public void setAttributes(java.util.Collection<Attribute> attributes) {
        if (attributes == null) {
            this.attributes = null;
            return;
        }

        this.attributes = new java.util.ArrayList<Attribute>(attributes);
    }
4719
public void removeAttribute(String name) {
        for(Map<String, ?> attributeValueMap : attributeMaps.values()) {
            clearAttribute(attributeValueMap, name);
        }
    }
829995
public GetQueueAttributesResult withAttributes(java.util.Map<String, String> attributes) {
        setAttributes(attributes);
        return this;
    }
109156
private XML checksAttributesExistence(Class<?> aClass,String[] attributes){
		if(!classExists(aClass)) Error.xmlClassInexistent(this.xmlPath,aClass);
		for (String attributeName : attributes) 
			try{ 				 aClass.getDeclaredField(attributeName);		  }
			catch (Exception e){ Error.attributeInexistent(attributeName, aClass);}
		return this;
	}
591057
public Scope setAttributes(Iterable<Pair> attributes)
    {
        if (attributes == null)
        {
            this.attributes = null;

            return this;
        }

        List<Pair> list = new ArrayList<Pair>();

        for (Pair attribute : attributes)
        {
            if (attribute == null || attribute.getKey() == null)
            {
                continue;
            }

            list.add(attribute);
        }

        int size = list.size();

        if (size == 0)
        {
            this.attributes = null;

            return this;
        }

        Pair[] array = new Pair[size];
        this.attributes = list.toArray(array);

        return this;
    }