public void replaceStringChildren ( List < String > strings ) { ArrayList < StringEntity > entities = new ArrayList <> ( ) ; for ( String string : strings ) { StringEntity entity = new StringEntity ( ) ; entity . setValue ( string ) ; entities . add ( entity ) ; } replaceAll ( entities ) ; }
This method allows to replace all string children it will remove any children which are not in the list add the new ones and update which are in the list .