I'm looking for a quick and easy way to check if all the items in an array are unique.
unique = ['one', 'two']
unique = []
not_unique = ['one', 'one', 'two']
# As simple as possible:
not_unique == not_unique.uniq
# or perhaps
not_unique.size == not_unique.uniq.size
array & array == array
is another option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With