List < List < Word > > getDifferentArguments ( List < List < Word > > argumentWords ) { List < List < Word >> result = Lists . newArrayList ( ) ; for ( int i = 0 ; i < argumentWords . size ( ) ; i ++ ) { result . add ( Lists . < Word > newArrayList ( ) ) ; } int nWords = argumentWords . get ( 0 ) . size ( ) ; for ( int iWord = 0 ; iWord < nWords ; iWord ++ ) { Word wordOfFirstCase = argumentWords . get ( 0 ) . get ( iWord ) ; // data tables have equal here, otherwise // the cases would be structurally different if ( wordOfFirstCase . isDataTable ( ) ) { continue ; } boolean different = false ; for ( int iCase = 1 ; iCase < argumentWords . size ( ) ; iCase ++ ) { Word wordOfCase = argumentWords . get ( iCase ) . get ( iWord ) ; if ( ! wordOfCase . getFormattedValue ( ) . equals ( wordOfFirstCase . getFormattedValue ( ) ) ) { different = true ; break ; } } if ( different ) { for ( int iCase = 0 ; iCase < argumentWords . size ( ) ; iCase ++ ) { result . get ( iCase ) . add ( argumentWords . get ( iCase ) . get ( iWord ) ) ; } } } return result ; }
Returns a list with argument words that are not equal in all cases