Collection < Session > getValidSessionsElseRemove ( String httpid , Predicate < Session > predicat ) { Collection < Session > wss = new ArrayList ( ) ; if ( httpid_wss . containsKey ( httpid ) ) { Collection < Session > befores = httpid_wss . get ( httpid ) ; for ( Session before : befores ) { if ( predicat . test ( before ) ) { wss . add ( before ) ; wsid_httpid . put ( before . getId ( ) , httpid ) ; } else { wsid_httpid . remove ( before . getId ( ) ) ; } } if ( wss . isEmpty ( ) ) { httpid_wss . remove ( httpid ) ; } else { httpid_wss . put ( httpid , wss ) ; } } return wss ; }
Return all sessions for httpid and for the predicate if some session negate the predicate its are removed