public boolean sameJob ( AutoTask jobAtIndex , AutoTask jobToAdd ) { Map < String , Object > propJobAtIndex = jobAtIndex . getProperties ( ) ; Map < String , Object > propJobToAdd = jobToAdd . getProperties ( ) ; if ( propJobAtIndex . size ( ) != propJobToAdd . size ( ) ) return false ; boolean bSameJob = false ; // They are equal if every property (except time) match for ( String strNewKey : propJobToAdd . keySet ( ) ) { if ( ! strNewKey . equalsIgnoreCase ( TIME_TO_RUN ) ) { if ( propJobAtIndex . get ( strNewKey ) . equals ( propJobToAdd . get ( strNewKey ) ) ) bSameJob = true ; // Okay, this is a potential match else return false ; // This property doesn't match, stop compare } } return bSameJob ; }
Do these two jobs match?