question: public static Set < String > nonMonogamousSamples ( Collection < Family > families ) { final LinkedHashSet < String > ret = new LinkedHashSet < > ( ) ; final HashSet < String > parents = new HashSet < > ( ) ; for ( Family f : families ) { if ( ! parents . add ( f . getFather ( ) ) ) { ret . add ( f . getFather ( ) ) ; } if ( ! parents . add ( f . getMother ( ) ) ) { ret . add ( f . getMother ( ) ) ; } } return ret ; }
target:  Detects the presence of genetic non-monogamy within an set of families