private void updateExistingRestrictionEnumerations(XsdRestriction existing, XsdRestriction newRestriction) {
        List<XsdEnumeration> existingEnumeration = existing.getEnumeration();
        List<XsdEnumeration> newRestrictionEnumeration = newRestriction.getEnumeration();

        if (existingEnumeration == null){
            existing.setEnumeration(newRestrictionEnumeration);
        } else {
            if (newRestrictionEnumeration != null){
                for (XsdEnumeration enumerationElem : newRestrictionEnumeration){
                    if (existingEnumeration.stream().noneMatch(existingEnumerationElem -> existingEnumerationElem.getValue().equals(enumerationElem.getValue()))){
                        existingEnumeration.add(enumerationElem);
                    }
                }
            }
        }
    }
private void updateExistingRestrictionEnumerations ( XsdRestriction existing , XsdRestriction newRestriction ) { List < XsdEnumeration > existingEnumeration = existing . getEnumeration ( ) ; List < XsdEnumeration > newRestrictionEnumeration = newRestriction . getEnumeration ( ) ; if ( existingEnumeration == null ) { existing . setEnumeration ( newRestrictionEnumeration ) ; } else { if ( newRestrictionEnumeration != null ) { for ( XsdEnumeration enumerationElem : newRestrictionEnumeration ) { if ( existingEnumeration . stream ( ) . noneMatch ( existingEnumerationElem -> existingEnumerationElem . getValue ( ) . equals ( enumerationElem . getValue ( ) ) ) ) { existingEnumeration . add ( enumerationElem ) ; } } } } }
Updates the existing {@link XsdRestriction} with the restrictions of the new {@link XsdRestriction} instance.
@param existing The existing {@link XsdRestriction} instance.
@param newRestriction The new {@link XsdRestriction} instance.