hasDuplicates and oneAndOnly methods