public boolean replace ( Object oldObj , Object newObj ) { if ( nest != null ) { return nest . replace ( oldObj , newObj ) ; } else { int sz = elements . size ( ) ; for ( int i = 0 ; i < sz ; i ++ ) { if ( elements . get ( i ) == oldObj ) { elements . set ( i , newObj ) ; return true ; } } } return false ; }
Replace an object within the composite .