public boolean inactiveSetChanged ( Collection < Host > hostsUp , Collection < Host > hostsDown ) { boolean newInactiveHostsFound = false ; // Check for condition 1. for ( Host hostDown : hostsDown ) { if ( activeHosts . contains ( hostDown ) ) { newInactiveHostsFound = true ; break ; } } // Check for condition 2. Set < Host > prevActiveHosts = new HashSet < Host > ( activeHosts ) ; prevActiveHosts . removeAll ( hostsUp ) ; newInactiveHostsFound = ! prevActiveHosts . isEmpty ( ) ; return newInactiveHostsFound ; }
This check is more involved than the active set check . Here we 2 conditions to check for