public void addPhoneNumber(String newPhoneNumber) {
        if (newPhoneNumber==null || newPhoneNumber.trim().length()==0) {
            return;
        }

        if (phoneNumbers == null) {
            phoneNumbers = new ArrayList<>(1);
        }
        for (PhoneNumber phoneNumber : phoneNumbers) {
            if (phoneNumber.value.equals(newPhoneNumber) && phoneNumber.getType() == null) {
                throw new IllegalArgumentException("Already contains phoneNumber " + newPhoneNumber);
            }
        }

        PhoneNumber number = new PhoneNumber();
        number.setValue(newPhoneNumber);
        phoneNumbers.add(number);
    }
public void addPhoneNumber ( String newPhoneNumber ) { if ( newPhoneNumber == null || newPhoneNumber . trim ( ) . length ( ) == 0 ) { return ; } if ( phoneNumbers == null ) { phoneNumbers = new ArrayList < > ( 1 ) ; } for ( PhoneNumber phoneNumber : phoneNumbers ) { if ( phoneNumber . value . equals ( newPhoneNumber ) && phoneNumber . getType ( ) == null ) { throw new IllegalArgumentException ( "Already contains phoneNumber " + newPhoneNumber ) ; } } PhoneNumber number = new PhoneNumber ( ) ; number . setValue ( newPhoneNumber ) ; phoneNumbers . add ( number ) ; }
Adds a new phone number with null type.

@param newPhoneNumber