List < Configuration > removeMismatching ( ) { // List mismatching List < InventoryEntry > mismatching = configs . values ( ) . stream ( ) . filter ( v -> ( v . getConfiguration ( ) . isPresent ( ) && ! v . getIdentifier ( ) . equals ( v . getConfiguration ( ) . get ( ) . getDetails ( ) . getKey ( ) ) ) ) . collect ( Collectors . toList ( ) ) ; // Remove from inventory mismatching . forEach ( v -> configs . remove ( v . getIdentifier ( ) ) ) ; // Return the list of removed configurations return mismatching . stream ( ) . map ( v -> v . getConfiguration ( ) . get ( ) ) . collect ( Collectors . toList ( ) ) ; }
Removes configurations with mismatching identifiers .