void cleanUp ( ) { Stream < Thing > rolePlayers = rolePlayers ( ) ; boolean performDeletion = rolePlayers . noneMatch ( thing -> thing != null && thing . id ( ) != null ) ; if ( performDeletion ) delete ( ) ; }
When a relation is deleted this cleans up any solitary casting and resources .