public boolean prefers ( int x , int y , int [ ] womanPref , int size ) { for ( int i = 0 ; i < size ; i ++ ) { int pref = womanPref [ i ] ; if ( pref == x ) { return true ; } if ( pref == y ) { return false ; } } // this should never happen. System . out . println ( "Error in womanPref list!" ) ; return false ; }
Returns true in case that a given woman prefers x to y .