public void write ( Writer out ) throws IOException { for ( int i = 0 ; i < elements . size ( ) ; i ++ ) { Object element = elements . get ( i ) ; if ( element instanceof Element ) ( ( Element ) element ) . write ( out ) ; else if ( element == null ) out . write ( "null" ) ; else out . write ( element . toString ( ) ) ; } }
Write the composite . The default implementation writes the elements sequentially . May be overridden for more specialized behaviour .